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