94 references to ObjectContext
System.Data.Entity (94)
System\Data\Objects\DataClasses\EntityCollection.cs (8)
255
wrappedEntities.Add(EntityWrapperFactory.WrapEntityUsingContext(entity,
ObjectContext
));
275
Attach(new IEntityWrapper[] { EntityWrapperFactory.WrapEntityUsingContext(entity,
ObjectContext
) }, false);
321
Add(EntityWrapperFactory.WrapEntityUsingContext(entity,
ObjectContext
));
382
return Remove(EntityWrapperFactory.WrapEntityUsingContext(entity,
ObjectContext
), /*preserveForeignKey*/false);
387
if (null != _wrappedRelatedEntities && null != this.
ObjectContext
)
406
if (null != _wrappedRelatedEntities && null != this.
ObjectContext
)
417
TransactionManager tm =
ObjectContext
.ObjectStateManager.TransactionManager;
799
_wrappedRelatedEntities.Add(entity, EntityWrapperFactory.WrapEntityUsingContext(entity,
ObjectContext
));
System\Data\Objects\DataClasses\EntityReference.cs (14)
90
if (this.
ObjectContext
!= null && !UsingNoTracking)
131
foreach (RelationshipEntry relationshipEntry in this.
ObjectContext
.ObjectStateManager.FindRelationshipsByKey(ownerKey))
173
if (this.
ObjectContext
!= null && !UsingNoTracking)
199
EntitySet targetEntitySet = value.GetEntitySet(
ObjectContext
.MetadataWorkspace);
201
value.ValidateEntityKey(
ObjectContext
.MetadataWorkspace, targetEntitySet, true /*isArgumentException */, "value");
203
ObjectStateManager manager = this.
ObjectContext
.ObjectStateManager;
329
Debug.Assert(this.
ObjectContext
!= null && !UsingNoTracking, "Should only need to access AttachedEntityKey property on attached EntityReferences");
356
if (this.
ObjectContext
!= null && this.
ObjectContext
.ObjectStateManager != null && // are we attached?
361
this.
ObjectContext
.ObjectStateManager.RemoveEntryFromForeignKeyIndex(_cachedForeignKey, source);
473
ObjectStateManager stateManager =
ObjectContext
.ObjectStateManager;
574
ObjectStateManager stateManager =
ObjectContext
.ObjectStateManager;
629
Debug.Assert(
ObjectContext
!= null, "Nulling FKs only works when attached.");
632
ObjectStateManager stateManager =
ObjectContext
.ObjectStateManager;
System\Data\Objects\DataClasses\EntityReference_TResultType.cs (17)
83
ReferenceValue = EntityWrapperFactory.WrapEntityUsingContext(value,
ObjectContext
);
114
ObjectContext context =
ObjectContext
?? value.Context;
147
if (
ObjectContext
!= null &&
ObjectContext
.ContextOptions.UseConsistentNullReferenceBehavior)
196
ObjectStateManager.RemoveRelationships(
ObjectContext
, mergeOption, (AssociationSet)RelationshipSet, sourceKey, (AssociationEndMember)FromEndProperty);
254
Attach(new IEntityWrapper[] { EntityWrapperFactory.WrapEntityUsingContext(entity,
ObjectContext
) }, false);
259
Debug.Assert(this.
ObjectContext
!= null, "Should not be trying to add entities to state manager if context is null");
282
ObjectStateManager manager = this.
ObjectContext
.ObjectStateManager;
304
foreach (RelationshipEntry relationshipEntry in this.
ObjectContext
.ObjectStateManager.FindRelationshipsByKey(DetachedEntityKey))
358
EntitySet targetEntitySet = DetachedEntityKey.GetEntitySet(this.
ObjectContext
.MetadataWorkspace);
372
Debug.Assert(this.
ObjectContext
!= null, "Should not be trying to remove entities from state manager if context is null");
380
TransactionManager transManager =
ObjectContext
.ObjectStateManager.TransactionManager;
436
RelationshipEntry relationshipEntry = this.
ObjectContext
.ObjectStateManager.FindRelationship(RelationshipSet,
569
if (
ObjectContext
!= null && IsForeignKey && !preserveForeignKey)
740
_wrappedCachedValue = EntityWrapperFactory.WrapEntityUsingContext(_cachedValue,
ObjectContext
);
766
TransactionManager tm =
ObjectContext
!= null ?
ObjectContext
.ObjectStateManager.TransactionManager : null;
System\Data\Objects\DataClasses\RelatedEnd.cs (53)
144
Debug.Assert(this.
ObjectContext
!= null, "the IsForeignKey property shouldn't be used in detached scenarios");
410
TypeUsage targetOSpaceTypeUsage =
ObjectContext
.MetadataWorkspace.GetOSpaceTypeUsage(TypeUsage.Create(targetEntityType));
520
AppendKeyParameterRow(sourceBuilder, key.GetEntitySet(
ObjectContext
.MetadataWorkspace).ElementType.KeyMembers);
540
?? key.GetEntitySet(
ObjectContext
.MetadataWorkspace).ElementType.KeyMembers;
576
((ClrEnumType)
ObjectContext
.MetadataWorkspace.GetObjectSpaceType((EnumType)parameterEdmType)).ClrType;
674
EntityEntry entry =
ObjectContext
.ObjectStateManager.FindEntityEntry(_wrappedOwner.Entity);
780
IEntityWrapper wrapper = EntityWrapperFactory.WrapEntityUsingContext(entity,
ObjectContext
);
785
EntityWrapperFactory.UpdateNoTrackingWrapper(wrapper,
ObjectContext
, targetEntitySet);
800
ObjectStateManager.UpdateRelationships(this.
ObjectContext
, mergeOption, (AssociationSet)RelationshipSet, (AssociationEndMember)FromEndProperty, sourceKey, _wrappedOwner, (AssociationEndMember)ToEndMember, collection, setIsLoaded);
837
Attach(new IEntityWrapper[] { EntityWrapperFactory.WrapEntityUsingContext(entity,
ObjectContext
) }, false);
864
ObjectStateManager stateManager =
ObjectContext
.ObjectStateManager;
903
if (null == this.
ObjectContext
|| UsingNoTracking)
909
EntityEntry stateEntry = this.
ObjectContext
.ObjectStateManager.GetEntityEntry(_wrappedOwner.Entity);
936
Debug.Assert(null != this.
ObjectContext
,
939
EntityEntry stateEntry =
ObjectContext
.ObjectStateManager.FindEntityEntry(wrappedEntity.Entity);
997
this.Add(EntityWrapperFactory.WrapEntityUsingContext(entity,
ObjectContext
));
1042
return Remove(EntityWrapperFactory.WrapEntityUsingContext(entity,
ObjectContext
), false);
1116
EntityEntry entry = this.
ObjectContext
.ObjectStateManager.FindEntityEntry(wrappedEntity.Entity);
1139
if ((object)key != null &&
ObjectContext
!= null)
1141
CheckRelationEntitySet(key.GetEntitySet(
ObjectContext
.MetadataWorkspace));
1146
if (Object.ReferenceEquals(this.
ObjectContext
, targetRelatedEnd.
ObjectContext
) && this.
ObjectContext
!= null)
1157
else if (this.
ObjectContext
!= null && targetRelatedEnd.
ObjectContext
!= null)
1165
wrappedTarget.ResetContext(this.
ObjectContext
, GetTargetEntitySetFromRelationshipSet(), MergeOption.NoTracking);
1173
else if ((_context == null || UsingNoTracking) && (targetRelatedEnd.
ObjectContext
!= null && !targetRelatedEnd.UsingNoTracking))
1226
if (Object.ReferenceEquals(this.
ObjectContext
, targetRelatedEnd.
ObjectContext
) && this.
ObjectContext
!= null)
1235
if (!this.
ObjectContext
.ObjectStateManager.TransactionManager.IsLocalPublicAPI &&
1248
(this.
ObjectContext
.ObjectStateManager.TransactionManager.IsAddTracking ||
1249
this.
ObjectContext
.ObjectStateManager.TransactionManager.IsAttachTracking ||
1250
this.
ObjectContext
.ObjectStateManager.TransactionManager.IsDetectChanges))
1256
else if (this.
ObjectContext
!= null || targetRelatedEnd.
ObjectContext
!= null)
1259
if (this.
ObjectContext
== null)
1333
if (this.
ObjectContext
!= null &&
1335
!this.
ObjectContext
.ObjectStateManager.TransactionManager.IsGraphUpdate)
1365
this.
ObjectContext
!= null && wrappedEntity.Context != null)
1437
this.
ObjectContext
!= null &&
1603
Debug.Assert(
ObjectContext
!= null, "Expected attached context at this point.");
1605
ObjectContext
.ObjectStateManager.TransactionManager.IsAddTracking &&
1662
if (this.
ObjectContext
!= null && wrappedEntity.Context != null)
1683
EntityEntry entry = this.
ObjectContext
.ObjectStateManager.GetEntityEntry(wrappedEntity.Entity);
1818
!(this.
ObjectContext
.ObjectStateManager.TransactionManager.IsAddTracking ||
1819
this.
ObjectContext
.ObjectStateManager.TransactionManager.IsAttachTracking))
1900
principalKey.ValidateEntityKey(
ObjectContext
.MetadataWorkspace, principalEntitySet);
2159
return this.
ObjectContext
.ObjectStateManager.AddRelation(
2399
detachedKey.ValidateEntityKey(
ObjectContext
.MetadataWorkspace, targetEntitySet);
2451
this.
ObjectContext
.ObjectStateManager.TransactionManager.IsAttachTracking &&
2452
this.
ObjectContext
.ObjectStateManager.TransactionManager.OriginalMergeOption == MergeOption.NoTracking)
2538
_wrappedOwner = EntityWrapperFactory.WrapEntityUsingContext(_owner,
ObjectContext
);
System\Data\Objects\DataClasses\RelationshipManager.cs (1)
1121
if (relatedEnd.
ObjectContext
!= null)
System\Data\Objects\ObjectViewFactory.cs (1)
162
TypeUsage ospaceElementTypeUsage = GetOSpaceTypeUsage(entityTypeUsage, entityCollection.
ObjectContext
);