2 implementations of Context
System.Data.Entity (2)
System\Data\Objects\Internal\BaseEntityWrapper.cs (1)
99
public ObjectContext
Context
System\Data\Objects\Internal\NullEntityWrapper.cs (1)
97
public ObjectContext
Context
2 writes to Context
System.Data.Entity (2)
System\Data\Objects\ObjectContext.cs (2)
711
wrappedEntity.
Context
= this;
1173
wrappedEntity.
Context
= this;
89 references to Context
System.Data.Entity (89)
System\Data\Objects\DataClasses\EntityCollection.cs (3)
332
if (null != wrappedEntity.
Context
&& wrappedEntity.MergeOption != MergeOption.NoTracking)
353
if (null != wrappedEntity.
Context
&& wrappedEntity.MergeOption != MergeOption.NoTracking)
394
IEntityWrapper identityWrapper = EntityWrapperFactory.WrapEntityUsingContext(wrappedEntity.Entity, WrappedOwner.
Context
);
System\Data\Objects\DataClasses\EntityReference.cs (1)
304
WrappedOwner.
Context
!= null &&
System\Data\Objects\DataClasses\EntityReference_TResultType.cs (4)
114
ObjectContext context = ObjectContext ?? value.
Context
;
266
IEntityWrapper identityWrapper = EntityWrapperFactory.WrapEntityUsingContext(_wrappedCachedValue.Entity, WrappedOwner.
Context
);
475
if (WrappedOwner.Entity != null && WrappedOwner.
Context
!= null && !UsingNoTracking)
477
EntityEntry ownerEntry = WrappedOwner.
Context
.ObjectStateManager.GetEntityEntry(WrappedOwner.Entity);
System\Data\Objects\DataClasses\RelatedEnd.cs (27)
1272
TransactionManager transManager = attachedRelatedEnd.WrappedOwner.
Context
.ObjectStateManager.TransactionManager;
1281
if (attachedRelatedEnd.WrappedOwner.
Context
.ObjectStateManager.TransactionManager.TrackProcessedEntities)
1284
if (!attachedRelatedEnd.WrappedOwner.
Context
.ObjectStateManager.TransactionManager.WrappedEntities.ContainsKey(entityToAdd.Entity))
1286
attachedRelatedEnd.WrappedOwner.
Context
.ObjectStateManager.TransactionManager.WrappedEntities.Add(entityToAdd.Entity, entityToAdd);
1288
attachedRelatedEnd.WrappedOwner.
Context
.ObjectStateManager.TransactionManager.ProcessedEntities.Add(attachedRelatedEnd.WrappedOwner);
1310
attachedRelatedEnd.WrappedOwner.
Context
.ObjectStateManager.DegradePromotedRelationships();
1327
attachedRelatedEnd.WrappedOwner.
Context
.ObjectStateManager.TransactionManager.EndAddTracking();
1365
this.ObjectContext != null && wrappedEntity.
Context
!= null)
1662
if (this.ObjectContext != null && wrappedEntity.
Context
!= null)
1722
Debug.Assert(wrapper.
Context
!= null, "Expected context to be available.");
1725
TransactionManager tm = wrapper.
Context
.ObjectStateManager.TransactionManager;
1728
wrapper.
Context
.ObjectStateManager.TrackPromotedRelationship(this, wrapper);
2151
Debug.Assert(this._context != null && wrappedEntity.
Context
!= null, "should be called only if both entities are attached");
2152
Debug.Assert(this._context == wrappedEntity.
Context
, "both entities should be attached to the same context");
2183
if (wrappedEntity.
Context
!= null &&
2184
wrappedEntity.
Context
.ObjectStateManager.TransactionManager.IsAttachTracking &&
2185
wrappedEntity.
Context
.ObjectStateManager.TransactionManager.PromotedKeyEntries.TryGetValue(wrappedEntity.Entity, out entry))
2225
if (wrappedEntity.
Context
!= null)
2227
entry = wrappedEntity.
Context
.ObjectStateManager.FindEntityEntry(wrappedEntity.Entity);
2242
if (wrappedOwner.
Context
!= null && wrappedEntity.
Context
!= null && relationshipSet != null)
2247
entry = wrappedEntity.
Context
.ObjectStateManager.DeleteRelationship(relationshipSet,
2257
if (wrappedOwner.
Context
!= null && wrappedEntity.
Context
!= null && relationshipSet != null)
2261
RelationshipEntry entry = wrappedEntity.
Context
.ObjectStateManager.FindRelationship(relationshipSet,
2549
if (this.navigationPropertyCache == null && _wrappedOwner.
Context
!= null && this.TargetAccessor.HasProperty)
2553
EntityType entityType = _wrappedOwner.
Context
.MetadataWorkspace.GetItem<EntityType>(_wrappedOwner.IdentityType.FullName, DataSpace.OSpace);
System\Data\Objects\DataClasses\RelationshipManager.cs (33)
375
Debug.Assert(wrappedOwner.
Context
!= null, "Context is null");
376
Debug.Assert(wrappedOwner.
Context
.MetadataWorkspace != null, "MetadataWorkspace is null");
377
Debug.Assert(wrappedOwner.
Context
.Perspective != null, "Perspective is null");
379
EntityType entityType = wrappedOwner.
Context
.MetadataWorkspace.GetItem<EntityType>(wrappedOwner.IdentityType.FullName, DataSpace.OSpace);
381
if (!wrappedOwner.
Context
.Perspective.TryGetMember(entityType, navigationProperty, false, out member) ||
413
if (wrappedOwner.
Context
== null && wrappedOwner.RequiresRelationshipChangeTracking)
535
if (wrappedOwner.
Context
!= null && wrappedOwner.MergeOption != MergeOption.NoTracking)
589
if (wrappedOwner.
Context
!= null && wrappedOwner.MergeOption != MergeOption.NoTracking)
654
if (wrappedOwner.
Context
!= null && wrappedOwner.
Context
.MetadataWorkspace != null)
656
return (ObjectItemCollection)wrappedOwner.
Context
.MetadataWorkspace.GetItemCollection(DataSpace.OSpace);
688
if (wrappedOwner.
Context
!= null && wrappedOwner.
Context
.MetadataWorkspace != null)
690
collection = (DefaultObjectMappingItemCollection)wrappedOwner.
Context
.MetadataWorkspace.GetItemCollection(DataSpace.OCSpace);
804
if (wrappedOwner.
Context
== null)
823
if (wrappedOwner.
Context
.Perspective.TryGetTypeByName(relationship.FullName, false/*ignoreCase*/, out associationTypeUsage))
826
EntityContainer entityContainer = wrappedOwner.
Context
.MetadataWorkspace.GetEntityContainer(
943
Debug.Assert(wrappedOwner.
Context
== null || wrappedOwner.MergeOption == MergeOption.NoTracking, "Expected null context when initializing an existing related end");
955
Debug.Assert(wrappedOwner.
Context
== null || wrappedOwner.MergeOption == MergeOption.NoTracking, "Expected null context or NoTracking when initializing an existing related end");
969
if (wrappedOwner.
Context
!= null)
971
relatedEnd.AttachContext(wrappedOwner.
Context
, wrappedOwner.MergeOption);
989
if (wrappedOwner.
Context
!= null && wrappedOwner.
Context
.MetadataWorkspace != null && TryGetOwnerEntityType(out entityType))
995
EntitySet entitySet = wrappedOwner.
Context
.GetEntitySet(wrappedOwner.EntityKey.EntitySetName, wrappedOwner.EntityKey.EntityContainerName);
1030
if (wrappedOwner.
Context
!= null && wrappedOwner.MergeOption != MergeOption.NoTracking)
1078
Debug.Assert(wrappedOwner.
Context
!= null && wrappedOwner.
Context
.ObjectStateManager != null, "Null context or ObjectStateManager");
1080
TransactionManager transManager = wrappedOwner.
Context
.ObjectStateManager.TransactionManager;
1087
wrappedOwner.
Context
.ObjectStateManager.DegradePromotedRelationships();
1271
EntityEntry entry = wrappedOwner.
Context
.ObjectStateManager.FindEntityEntry(ownerKey);
1292
EntityEntry entry = wrappedOwner.
Context
.ObjectStateManager.FindEntityEntry(ownerKey);
1444
EntityUtil.CheckContextNull(wrappedOwner.
Context
);
1445
EntitySet entitySet = ownerKey.GetEntitySet(wrappedOwner.
Context
.MetadataWorkspace);
System\Data\Objects\Internal\EntityProxyFactory.cs (2)
529
if (wrappedEntity != null && wrappedEntity.
Context
!= null)
531
wrappedEntity.
Context
.ObjectStateManager.EntityInvokingFKSetter = null;
System\Data\Objects\Internal\EntityWrapperFactory.cs (1)
303
if (wrapper.
Context
== null)
System\Data\Objects\Internal\LazyLoadBehavior.cs (1)
169
if (wrapper != null && wrapper.
Context
!= null)
System\Data\Objects\Internal\PocoPropertyAccessorStrategy.cs (1)
106
ObjectTypeMapping mapping = System.Data.Common.Internal.Materialization.Util.GetObjectMapping(declaringEntityType, relatedEnd.WrappedOwner.
Context
.MetadataWorkspace);
System\Data\Objects\ObjectContext.cs (7)
663
if (doCleanup && wrappedEntity.
Context
== this)
823
if (wrappedEntity.
Context
== null)
827
if (wrappedEntity.
Context
!= this)
1046
if (doCleanup && wrappedEntity.
Context
== this)
1196
if (wrappedEntity.
Context
!= null &&
1197
wrappedEntity.
Context
!= this &&
1198
!wrappedEntity.
Context
.ObjectStateManager.IsDisposed &&
System\Data\Objects\ObjectStateManager.cs (9)
333
Debug.Assert(wrappedObject.
Context
!= null, "the context should be already set");
697
Debug.Assert(wrappedEntity.
Context
!= null, "the context should be already set");
902
Debug.Assert(!(inKeyEntryPromotion && wrappedSource.
Context
== null),
906
wrappedSource.
Context
.ObjectStateManager.TransactionManager.IsAttachTracking &&
916
if (inKeyEntryPromotion && wrappedSource.
Context
.ObjectStateManager.TransactionManager.IsAttachTracking)
918
wrappedSource.
Context
.ObjectStateManager.TrackPromotedRelationship(relatedEnd, wrappedTarget);
919
wrappedSource.
Context
.ObjectStateManager.TrackPromotedRelationship(targetRelatedEnd, wrappedSource);
1412
Debug.Assert(wrappedObject.
Context
!= null, "the context should be already set");
2670
if (wrappedEntity.
Context
== null)