2 writes to _cache
System.Data.Entity (2)
System\Data\Objects\ObjectStateEntry.cs (2)
45
_cache
= cache;
346
_cache
= null;
118 references to _cache
System.Data.Entity (118)
System\Data\Objects\EntityEntry.cs (102)
219
_cache
.ChangeState(this, EntityState.Unchanged, State);
438
if (
_cache
!= null)
440
_cache
.ChangeState(this, EntityState.Deleted, EntityState.Detached);
457
_cache
.FixupKey(this);
475
_cache
.ChangeState(this, EntityState.Modified, EntityState.Unchanged);
480
_cache
.FixupReferencesByForeignKeys(this);
505
_cache
.ChangeState(this, EntityState.Unchanged, State);
903
Debug.Assert(
_cache
!= null, "Cannot Reset an entity that is not currently attached to a context.");
905
_cache
.ForgetEntryWithConceptualNull(this, resetAllKeys: true);
941
_cache
.ChangeState(this, EntityState.Deleted, State);
951
foreach (RelationshipEntry entry in
_cache
.CopyOfRelationshipsByKey(EntityKey))
1081
if ((changingObject !=
_cache
.ChangingObject) ||
1082
(changingMemberName !=
_cache
.ChangingMember) ||
1083
(entityMemberName !=
_cache
.ChangingEntityMember))
1091
if (this.State !=
_cache
.ChangingState)
1093
throw EntityUtil.ChangedInDifferentStateFromChanging(this.State,
_cache
.ChangingState);
1096
object oldValue =
_cache
.ChangingOldValue;
1099
if (
_cache
.SaveOriginalValues)
1163
if (
_cache
!= null && !
_cache
.TransactionManager.IsOriginalValuesGetter)
1176
_cache
.ChangeState(this, initialState, this.State);
1182
Debug.Assert(
_cache
!= null, "Unexpected null state manager.");
1226
newValue =
_cache
.ComplexTypeMaterializer.CreateComplex(newValueRecord, newValueRecord.DataRecordInfo, null);
1280
_cache
.SaveOriginalValues = (State == EntityState.Unchanged || State == EntityState.Modified) &&
1344
_cache
.GetOrAddStateManagerTypeMetadata(member.CdmMetadata.TypeUsage.EdmType), retValue);
1348
_cache
.GetOrAddStateManagerTypeMetadata(member.CdmMetadata.TypeUsage.EdmType), retValue);
1352
_cache
.GetOrAddStateManagerTypeMetadata(member.CdmMetadata.TypeUsage.EdmType), retValue);
1356
_cache
.GetOrAddStateManagerTypeMetadata(member.CdmMetadata.TypeUsage.EdmType), retValue, parentEntityPropertyIndex);
1424
return
_cache
.GetEntityEntry(relationshipEntry.RelationshipWrapper.GetOtherEntityKey(this.EntityKey));
1448
StateManagerTypeMetadata typeMetadata =
_cache
.GetOrAddStateManagerTypeMetadata(memberMetadata.CdmMetadata.TypeUsage.EdmType);
1548
if (!
_cache
.InRelationshipFixup)
1587
tmpTypeMetadata =
_cache
.GetOrAddStateManagerTypeMetadata(complexObject.GetType(), (EntitySet)this.EntitySet);
1607
_cache
.EntityInvokingFKSetter = WrappedEntity.Entity;
1625
_cache
.ChangingEntityMember = entityMemberName;
1626
_cache
.ChangingObject = changingObject;
1627
_cache
.ChangingMember = changingMember;
1628
_cache
.ChangingState = changingState;
1629
_cache
.ChangingOldValue = oldValue;
1632
_cache
.SaveOriginalValues = false;
1659
if (!this.
_cache
.TransactionManager.IsAttachTracking ||
1660
this.
_cache
.TransactionManager.OriginalMergeOption != MergeOption.NoTracking)
1733
StateManagerTypeMetadata typeMetadata =
_cache
.GetOrAddStateManagerTypeMetadata(member.CdmMetadata.TypeUsage.EdmType);
1840
Debug.Assert(
_cache
.SaveOriginalValues, "complex object instance was changed so the SaveOriginalValues flag should be set to true");
1846
_cache
.ChangingOldValue = oldComplexValue;
1944
StateManagerTypeMetadata metadata =
_cache
.GetOrAddStateManagerTypeMetadata(complexMember.CdmMetadata.TypeUsage.EdmType);
1972
_cache
.ChangingOldValue = oldNestedComplexValue;
2057
StateManagerTypeMetadata typeMetadata =
_cache
.GetOrAddStateManagerTypeMetadata(member.CdmMetadata.TypeUsage.EdmType);
2111
if (
_cache
.TryGetObjectStateEntry(principal, out principalEntry) &&
2423
_cache
.TransactionManager.BeginDetaching();
2436
_cache
.TransactionManager.EndDetaching();
2463
_cache
.ChangeState(this, this.State, EntityState.Detached);
2495
_cache
.ChangeState(this, EntityState.Added, EntityState.Detached);
2509
_cache
.ChangeState(this, EntityState.Modified, EntityState.Deleted);
2523
_cache
.ChangeState(this, EntityState.Unchanged, EntityState.Deleted);
2550
foreach (RelationshipEntry relationshipEntry in
_cache
.FindRelationshipsByKey(EntityKey))
2557
EntityEntry relatedEntry =
_cache
.GetEntityEntry(targetKey);
2576
foreach (RelationshipEntry relationshipEntry in
_cache
.CopyOfRelationshipsByKey(EntityKey))
2582
EntityEntry relatedEntry =
_cache
.GetEntityEntry(targetKey);
2637
foreach (RelationshipEntry relationshipEntry in
_cache
.CopyOfRelationshipsByKey(EntityKey))
2652
EntityEntry relatedEntry =
_cache
.GetEntityEntry(entityKey);
2716
foreach (RelationshipEntry relationshipEntry in
_cache
.FindRelationshipsByKey(EntityKey))
2788
foreach (RelationshipEntry relationshipEntry in
_cache
.FindRelationshipsByKey(EntityKey))
2888
_cache
.ChangeState(this, this.State, EntityState.Unchanged);
2892
_cache
.RemoveEntryFromKeylessStore(_wrappedEntity);
2901
_cache
.OnObjectStateManagerChanged(CollectionChangeAction.Remove, degradedEntity);
3029
newValue =
_cache
.ComplexTypeMaterializer.CreateComplex(newValueRecord, newValueRecord.DataRecordInfo, null);
3037
foreach (RelationshipEntry relationshipEntry in
_cache
.CopyOfRelationshipsByKey(this.EntityKey))
3097
_cache
.ForgetEntryWithConceptualNull(this, resetAllKeys: true);
3190
_cache
.FixupReferencesByForeignKeys(this); // Make sure refs based on FK values are set
3191
_cache
.OnObjectStateManagerChanged(CollectionChangeAction.Add, Entity);
3205
_cache
.FixupReferencesByForeignKeys(this); // Make sure refs based on FK values are set
3206
_cache
.OnObjectStateManagerChanged(CollectionChangeAction.Add, Entity);
3218
_cache
.FixupReferencesByForeignKeys(this); // Make sure refs based on FK values are set
3219
_cache
.OnObjectStateManagerChanged(CollectionChangeAction.Add, Entity);
3338
(
_cache
.EntryHasConceptualNull(this) && _modifiedFields != null && _modifiedFields[propertyIndex]);
3404
_cache
.RemoveEntryFromForeignKeyIndex(foreignKey, this);
3407
_cache
.AssertEntryDoesNotExistInForeignKeyIndex(this);
3418
Debug.Assert(
_cache
!= null, "Attempt to fixup detached entity entry");
3419
_cache
.TransactionManager.BeginGraphUpdate();
3420
bool setIsLoaded = !(
_cache
.TransactionManager.IsAttachTracking ||
_cache
.TransactionManager.IsAddTracking);
3437
_cache
.TransactionManager.EndGraphUpdate();
3479
if (
_cache
.TransactionManager.RelationshipBeingUpdated != reference)
3483
ObjectStateManager stateManager =
_cache
;
3484
_cache
.TransactionManager.BeginGraphUpdate();
3490
_cache
.TransactionManager.EntityBeingReparented = Entity;
3498
Debug.Assert(
_cache
!= null, "Unexpected null state manager.");
3499
_cache
.TransactionManager.EntityBeingReparented = null;
3500
_cache
.TransactionManager.EndGraphUpdate();
3529
bool canModifyReference =
_cache
.TransactionManager.RelationshipBeingUpdated != relatedEnd &&
3530
(!
_cache
.TransactionManager.IsForeignKeyUpdate ||
3544
if (
_cache
.TryGetEntityEntry(foreignKey, out principalEntry) &&
3554
if (
_cache
.TransactionManager.PopulatedEntityReferences != null)
3556
Debug.Assert(
_cache
.TransactionManager.IsAddTracking ||
_cache
.TransactionManager.IsAttachTracking,
3558
_cache
.TransactionManager.PopulatedEntityReferences.Add(relatedEnd);
3564
if (
_cache
.TransactionManager.PopulatedEntityReferences != null)
3569
_cache
.TransactionManager.PopulatedEntityReferences.Add(otherEnd);
3581
_cache
.AddEntryContainingForeignKeyToIndex(foreignKey, this);
3672
Debug.Assert(
_cache
!= null, "Attempt to fixup detached entity entry");
3673
_cache
.TransactionManager.BeginFixupKeysByReference();
3680
_cache
.TransactionManager.EndFixupKeysByReference();
System\Data\Objects\ObjectStateEntry.cs (2)
62
return
_cache
;
357
Debug.Assert(null !=
_cache
, "null ObjectStateManager");
System\Data\Objects\ObjectStateManager.cs (1)
519
Debug.Assert(entry.
_cache
!= null, "found an entry in the _danglingForeignKeys collection that has been nulled out");
System\Data\Objects\RelationshipEntry.cs (13)
74
if (
_cache
!= null)
76
_cache
.ChangeState(this, EntityState.Deleted, EntityState.Detached);
80
_cache
.ChangeState(this, EntityState.Added, EntityState.Unchanged);
320
_cache
.ChangeState(this, EntityState.Deleted, State);
466
EntityEntry relatedEntry =
_cache
.GetEntityEntry(entityKey);
472
foreach (RelationshipEntry relationshipEntry in
_cache
.FindRelationshipsByKey(entityKey))
484
_cache
.DeleteKeyEntry(relatedEntry);
503
EntityEntry entry1 =
_cache
.GetEntityEntry((EntityKey)GetCurrentRelationValue(0));
505
EntityEntry entry2 =
_cache
.GetEntityEntry((EntityKey)GetCurrentRelationValue(1));
561
_cache
.ChangeState(this, this.State, EntityState.Deleted);
584
_cache
.ChangeState(this, EntityState.Unchanged, EntityState.Deleted);
600
if (
_cache
!= null)
602
_cache
.ChangeState(this, this.State, EntityState.Detached);