2 implementations of Entity
System.Data.Entity (2)
System\Data\Objects\Internal\BaseEntityWrapper.cs (1)
230
public abstract object
Entity
{ get; }
System\Data\Objects\Internal\NullEntityWrapper.cs (1)
56
public object
Entity
234 references to Entity
System.Data.Entity (234)
System\Data\Common\EntityUtil.cs (1)
1496
throw EntityUtil.EntityKeyDoesntMatchKeySetOnEntity(wrappedEntity.
Entity
);
System\Data\Common\Internal\Materialization\Coordinator.cs (1)
277
element = (T)wrappedElement.
Entity
;
System\Data\Common\Internal\Materialization\Shaper.cs (13)
142
Debug.Assert(null != wrappedEntity.
Entity
, "if HandleEntity is called, there must be an entity");
242
if (null != wrappedEntity.
Entity
)
256
if (wrappedSource.
Entity
== null)
261
if (wrappedSpannedEntity.
Entity
!= null)
283
if (null == wrappedEntity.
Entity
)
696
Debug.Assert(wrappedSource.
Entity
!= null);
723
if (wrappedSource.
Entity
!= null)
744
Debug.Assert(null != wrappedEntity.
Entity
, "null entity");
770
existingEntry.UpdateCurrentValueRecord(wrappedEntity.
Entity
);
781
existingEntry.UpdateCurrentValueRecord(wrappedEntity.
Entity
);
791
existingEntry.UpdateRecordWithoutSetModified(wrappedEntity.
Entity
, existingEntry.EditableOriginalValues);
796
existingEntry.UpdateRecordWithSetModified(wrappedEntity.
Entity
, existingEntry.EditableOriginalValues);
977
Context.OnObjectMaterialized(wrappedEntity.
Entity
);
System\Data\Objects\DataClasses\EntityCollection.cs (18)
191
if (WrappedOwner.
Entity
!= null)
341
OnAssociationChanged(CollectionChangeAction.Add, wrappedEntity.
Entity
);
360
OnAssociationChanged(CollectionChangeAction.Remove, wrappedEntity.
Entity
);
394
IEntityWrapper identityWrapper = EntityWrapperFactory.WrapEntityUsingContext(wrappedEntity.
Entity
, WrappedOwner.Context);
397
_wrappedRelatedEntities[(TEntity)identityWrapper.
Entity
] = identityWrapper;
465
if ((wrappedEntity.
Entity
== wrappedCurrent.
Entity
) && (navigation.Equals(RelationshipNavigation)))
511
return wrappedEntity.
Entity
is TEntity;
518
throw EntityUtil.InvalidContainedTypeCollection(wrappedEntity.
Entity
.GetType().FullName, typeof(TEntity).FullName);
532
if (_wrappedRelatedEntities != null && _wrappedRelatedEntities.Remove((TEntity)wrappedEntity.
Entity
))
555
return this.WrappedOwner.CollectionRemove(this, (TEntity)wrappedEntity.
Entity
);
592
TEntity entity = wrappedEntity.
Entity
as TEntity;
632
if (WrappedOwner.
Entity
!= null)
744
this.TargetAccessor.PropertyName, this.WrappedOwner.
Entity
.GetType().FullName));
750
if (Object.Equals(o, wrapper.
Entity
))
774
if (!(WrappedOwner.
Entity
is IEntityWithRelationships))
824
WrappedRelatedEntities[(TEntity)wrappedEntity.
Entity
] = wrappedEntity;
834
this.WrappedOwner.CollectionAdd(this, wrappedEntity.
Entity
);
System\Data\Objects\DataClasses\EntityReference.cs (21)
92
Debug.Assert(this.WrappedOwner.
Entity
!= null, "Unexpected null Owner on EntityReference attached to a context");
97
if (CachedValue.
Entity
!= null)
161
if (value != null && value == EntityKey && (ReferenceValue.
Entity
!= null || (ReferenceValue.
Entity
== null && !forceFixup)))
175
Debug.Assert(this.WrappedOwner.
Entity
!= null, "Unexpected null Owner on EntityReference attached to a context");
249
manager.TransactionManager.EntityBeingReparented = WrappedOwner.
Entity
;
302
if (ReferenceValue.
Entity
== null &&
303
WrappedOwner.
Entity
!= null &&
410
else if (checkBothEnds && targetEntity != null && targetEntity.
Entity
!= null)
463
Debug.Assert(dependentEntity.
Entity
!= null, "dependentEntity.Entity == null");
464
Debug.Assert(principalEntity.
Entity
!= null, "principalEntity.Entity == null");
495
object value = principalTypeMetadata.Member(principalOrdinal).GetValue(principalEntity.
Entity
);
497
bool valueChanging = !ByValueEqualityComparer.Default.Equals(dependentTypeMetadata.Member(dependentOrdinal).GetValue(dependentEntity.
Entity
), value);
526
dependentEntity.
Entity
,
567
Debug.Assert(dependentEntity.
Entity
!= null, "dependentEntity.Entity == null");
585
object currentValue = dependentTypeMetadata.Member(dependentOrdinal).GetValue(dependentEntity.
Entity
);
592
dependentEntity.
Entity
,
612
WrappedOwner.
Entity
:
653
else if (!ReferenceEquals(stateManager.EntityInvokingFKSetter, WrappedOwner.
Entity
) && !transManager.IsForeignKeyUpdate)
678
if (member.GetValue(WrappedOwner.
Entity
) != null)
684
WrappedOwner.
Entity
,
System\Data\Objects\DataClasses\EntityReference_TResultType.cs (40)
79
return (TEntity)ReferenceValue.
Entity
;
104
if (value.
Entity
!= null && value.
Entity
== _wrappedCachedValue.
Entity
)
109
if (null != value.
Entity
)
117
context.ObjectStateManager.TransactionManager.EntityBeingReparented = GetDependentEndOfReferentialConstraint(value.
Entity
);
135
if (_wrappedCachedValue.
Entity
!= null)
227
if (ReferenceValue.
Entity
!= null)
229
yield return (TEntity)ReferenceValue.
Entity
;
236
return _wrappedCachedValue.
Entity
== null ? new IEntityWrapper[0] : new IEntityWrapper[] { _wrappedCachedValue };
262
if (null != _wrappedCachedValue.
Entity
)
266
IEntityWrapper identityWrapper = EntityWrapperFactory.WrapEntityUsingContext(_wrappedCachedValue.
Entity
, WrappedOwner.Context);
374
if (null != _wrappedCachedValue.
Entity
)
458
if (null != _wrappedCachedValue.
Entity
)
462
if ((wrappedEntity.
Entity
== _wrappedCachedValue.
Entity
) && (navigation.Equals(this.RelationshipNavigation)))
475
if (WrappedOwner.
Entity
!= null && WrappedOwner.Context != null && !UsingNoTracking)
477
EntityEntry ownerEntry = WrappedOwner.Context.ObjectStateManager.GetEntityEntry(WrappedOwner.
Entity
);
484
if (this.WrappedOwner.
Entity
!= null)
519
return wrappedEntity.
Entity
is TEntity;
526
throw EntityUtil.InvalidContainedTypeReference(wrappedEntity.
Entity
.GetType().FullName, typeof(TEntity).FullName);
558
Debug.Assert(null == _wrappedCachedValue.
Entity
|| wrappedEntity.
Entity
== _wrappedCachedValue.
Entity
, "The specified object is not a part of this relationship.");
588
this.WrappedOwner.RemoveNavigationPropertyValue(this, (TEntity)wrappedEntity.
Entity
);
600
if (this._wrappedCachedValue.
Entity
!= null)
644
return _wrappedCachedValue.
Entity
== null;
669
return null != _wrappedCachedValue.
Entity
&& _wrappedCachedValue.
Entity
== wrappedEntity.
Entity
;
694
Debug.Assert(this._wrappedCachedValue.
Entity
== null, "The EntityReference already has a value.");
696
if (reference != null && reference._wrappedCachedValue.
Entity
!= null)
699
_cachedValue = (TEntity)_wrappedCachedValue.
Entity
;
715
return Object.Equals(value, wrapper.
Entity
);
723
if (!Object.ReferenceEquals(null, value) && !Object.Equals(value, wrapper.
Entity
))
748
if (!(WrappedOwner.
Entity
is IEntityWithRelationships))
767
if (applyConstraints && null != _wrappedCachedValue.
Entity
)
777
if (tm != null && wrappedEntity.
Entity
!= null)
787
_cachedValue = (TEntity)wrappedEntity.
Entity
;
804
this.WrappedOwner.SetNavigationPropertyValue(this, wrappedEntity.
Entity
);
System\Data\Objects\DataClasses\RelatedEnd.cs (33)
48
EntityUtil.CheckArgumentNull(wrappedOwner.
Entity
, "wrappedOwner.Entity");
336
EntityEntry stateEntry = _context.ObjectStateManager.FindEntityEntry(_wrappedOwner.
Entity
);
613
return metaMember.GetValue(_wrappedOwner.
Entity
);
674
EntityEntry entry = ObjectContext.ObjectStateManager.FindEntityEntry(_wrappedOwner.
Entity
);
865
EntityEntry ownerEntry = stateManager.FindEntityEntry(_wrappedOwner.
Entity
);
882
EntityEntry targetEntry = stateManager.FindEntityEntry(((EntityReference)targetRelatedEnd).WrappedOwner.
Entity
);
909
EntityEntry stateEntry = this.ObjectContext.ObjectStateManager.GetEntityEntry(_wrappedOwner.
Entity
);
920
if (null == wrappedEntity || null == wrappedEntity.
Entity
)
939
EntityEntry stateEntry = ObjectContext.ObjectStateManager.FindEntityEntry(wrappedEntity.
Entity
);
940
if (null == stateEntry || !Object.ReferenceEquals(stateEntry.Entity, wrappedEntity.
Entity
))
1004
if (_wrappedOwner.
Entity
!= null)
1051
if (_wrappedOwner.
Entity
!= null)
1116
EntityEntry entry = this.ObjectContext.ObjectStateManager.FindEntityEntry(wrappedEntity.
Entity
);
1284
if (!attachedRelatedEnd.WrappedOwner.Context.ObjectStateManager.TransactionManager.WrappedEntities.ContainsKey(entityToAdd.
Entity
))
1286
attachedRelatedEnd.WrappedOwner.Context.ObjectStateManager.TransactionManager.WrappedEntities.Add(entityToAdd.
Entity
, entityToAdd);
1353
targetRelatedEnd.OnAssociationChanged(CollectionChangeAction.Add, _wrappedOwner.
Entity
);
1354
OnAssociationChanged(CollectionChangeAction.Add, wrappedTarget.
Entity
);
1377
EntityEntry entry = _context.ObjectStateManager.GetEntityEntry(wrappedEntity.
Entity
);
1457
!ReferenceEquals(wrappedEntity.
Entity
, _context.ObjectStateManager.TransactionManager.EntityBeingReparented) &&
1458
!ReferenceEquals(_context.ObjectStateManager.EntityInvokingFKSetter, wrappedEntity.
Entity
))
1473
OnAssociationChanged(CollectionChangeAction.Remove, wrappedEntity.
Entity
);
1575
EntityEntry cacheEntry = _context.ObjectStateManager.FindEntityEntry(wrappedEntity.
Entity
);
1576
Debug.Assert(cacheEntry == null || cacheEntry.Entity == wrappedEntity.
Entity
,
1683
EntityEntry entry = this.ObjectContext.ObjectStateManager.GetEntityEntry(wrappedEntity.
Entity
);
1756
EntityEntry cacheEntry = _context.ObjectStateManager.FindEntityEntry(wrappedEntity.
Entity
);
1904
principalKey = _context.ObjectStateManager.CreateEntityKey(principalEntitySet, wrappedRelatedEntity.
Entity
);
2026
relatedEnd.OnAssociationChanged(CollectionChangeAction.Remove, _wrappedOwner.
Entity
);
2185
wrappedEntity.Context.ObjectStateManager.TransactionManager.PromotedKeyEntries.TryGetValue(wrappedEntity.
Entity
, out entry))
2227
entry = wrappedEntity.Context.ObjectStateManager.FindEntityEntry(wrappedEntity.
Entity
);
2497
if (_wrappedOwner.
Entity
== null)
2517
_owner = wrappedOwner.
Entity
as IEntityWithRelationships;
2572
if (_wrappedOwner.
Entity
!= null)
2592
Debug.Assert(_wrappedOwner.
Entity
!= null, "Must be connected to lookup metadata");
System\Data\Objects\DataClasses\RelationshipManager.cs (12)
170
Debug.Assert(_owner != null || !(wrappedOwner.
Entity
is IEntityWithRelationships), "_owner should only be null if entity is not IEntityWithRelationships");
374
Debug.Assert(wrappedOwner.
Entity
!= null, "Entity is null");
529
if (entityReference.WrappedOwner.
Entity
!= null)
583
if (entityCollection.WrappedOwner.
Entity
!= null)
728
if (EntityProxyFactory.IsProxyType(wrappedOwner.
Entity
.GetType()))
1008
if (wrappedOwner.
Entity
!= null)
1025
if (!(wrappedOwner.
Entity
is IEntityWithRelationships))
1097
transManager.PromotedKeyEntries.TryGetValue(wrappedOwner.
Entity
, out entry))
1222
Debug.Assert(wrappedOwner.
Entity
!= null);
1437
Debug.Assert(wrappedOwner.
Entity
!= null);
1494
return Object.ReferenceEquals(wrappedEntity.
Entity
, wrappedOwner.
Entity
);
System\Data\Objects\ELinq\InitializerFacet.cs (1)
494
if (null == wrappedOwner.
Entity
)
System\Data\Objects\EntityEntry.cs (43)
64
Debug.Assert(wrappedEntity.
Entity
!= null, "entity cannot be null.");
134
return _wrappedEntity.
Entity
;
293
var originalValue = GetOriginalEntityValue(_cacheTypeMetadata, ordinal, _wrappedEntity.
Entity
, ObjectStateValueRecord.OriginalReadonly);
294
SetCurrentEntityValue(_cacheTypeMetadata, ordinal, _wrappedEntity.
Entity
, originalValue);
351
return new ObjectStateEntryDbDataRecord(this, _cacheTypeMetadata, _wrappedEntity.
Entity
);
355
return new ObjectStateEntryOriginalDbUpdatableDataRecord_Public(this, _cacheTypeMetadata, _wrappedEntity.
Entity
, s_EntityRoot);
403
return new ObjectStateEntryDbUpdatableDataRecord(this, _cacheTypeMetadata, _wrappedEntity.
Entity
);
523
if (WrappedEntity.
Entity
== null)
877
return null == _wrappedEntity.
Entity
;
1191
SetCurrentEntityValue(_cacheTypeMetadata, ordinal, _wrappedEntity.
Entity
, newValue);
1295
return GetOriginalEntityValue(_cacheTypeMetadata, ordinal, _wrappedEntity.
Entity
, ObjectStateValueRecord.OriginalReadonly);
1607
_cache.EntityInvokingFKSetter = WrappedEntity.
Entity
;
1647
return new ObjectStateEntryOriginalDbUpdatableDataRecord_Internal(this, _cacheTypeMetadata, _wrappedEntity.
Entity
);
1690
currentValue = member.GetValue(this._wrappedEntity.
Entity
);
1696
currentValue = member.GetValue(this._wrappedEntity.
Entity
);
1697
this.AddOriginalValue(member, this._wrappedEntity.
Entity
, currentValue);
1821
var currentValue = member.GetValue(this._wrappedEntity.
Entity
);
1869
var originalValueFound = this.FindOriginalValue(member, this._wrappedEntity.
Entity
, out originalStateManagerValue);
2126
Debug.Assert(!(this._wrappedEntity.
Entity
is IEntityWithRelationships), "this method should be called only for entities which don't implement IEntityWithRelationships");
2227
otherRelatedEnd.OnAssociationChanged(CollectionChangeAction.Add, _wrappedEntity.
Entity
);
2241
relatedEnd.OnAssociationChanged(CollectionChangeAction.Add, relatedWrapper.
Entity
);
2833
Debug.Assert(wrappedEntity.
Entity
!= null, "entity cannot be null.");
2896
object degradedEntity = _wrappedEntity.
Entity
;
2909
Debug.Assert(_wrappedEntity.
Entity
!= null, "Cannot attach a null entity to the state manager");
2962
currentValueOld = member.GetValue(_wrappedEntity.
Entity
);
2976
return GetCurrentEntityValue(_cacheTypeMetadata, ordinal, _wrappedEntity.
Entity
, ObjectStateValueRecord.CurrentUpdatable);
3354
throw EntityUtil.EntitiesHaveDifferentType(this.Entity.GetType().FullName, wrappedCurrentEntity.
Entity
.GetType().FullName);
3357
this.CompareKeyProperties(wrappedCurrentEntity.
Entity
);
3359
UpdateCurrentValueRecord(wrappedCurrentEntity.
Entity
);
3382
throw EntityUtil.EntitiesHaveDifferentType(this.Entity.GetType().FullName, wrappedOriginalEntity.
Entity
.GetType().FullName);
3385
this.CompareKeyProperties(wrappedOriginalEntity.
Entity
);
3389
this.UpdateOriginalValues(wrappedOriginalEntity.
Entity
);
3459
if ((object)foreignKey == null || existingPrincipal.
Entity
== null)
3582
if (canModifyReference && replaceExistingRef && relatedEnd.ReferenceValue.
Entity
!= null)
3590
if (replaceExistingRef && (relatedEnd.ReferenceValue.
Entity
!= null || relatedEnd.EntityKey != null))
3615
if ((refToPrincipal.ReferenceValue.
Entity
== null && refToPrincipal.NavigationPropertyIsNullOrMissing()) &&
3616
(refToDependent == null || (refToDependent.ReferenceValue.
Entity
== null && refToDependent.NavigationPropertyIsNullOrMissing())))
3622
(Object.ReferenceEquals(refToDependent.ReferenceValue.
Entity
, refToPrincipal.WrappedOwner.
Entity
) ||
3628
Object.ReferenceEquals(refToPrincipal.ReferenceValue.
Entity
, wrappedPrincipal.
Entity
) ||
3656
if (relatedEnd.CachedValue.
Entity
== null || relatedEnd.CachedValue.ObjectStateEntry == null)
3705
if (existingPrincipal.
Entity
!= null)
System\Data\Objects\Internal\EntityProxyFactory.cs (1)
197
return (EntityProxyFactory.TryGetProxyType(wrappedEntity.
Entity
.GetType(), out proxyInfo) && proxyInfo != null &&
System\Data\Objects\Internal\EntityProxyTypeInfo.cs (3)
95
if (wrapper != null && !object.ReferenceEquals(wrapper.
Entity
, proxy))
199
Debug.Assert(wrapper.
Entity
!= null, "proxy must be non-null");
200
return Proxy_SetEntityWrapper(wrapper.
Entity
, wrapper) as IEntityWrapper;
System\Data\Objects\Internal\EntityWrapperFactory.cs (2)
263
if (!Object.ReferenceEquals(wrappedEntity.
Entity
, entity))
301
wrapper.EntityKey = context.ObjectStateManager.CreateEntityKey(entitySet, wrapper.
Entity
);
System\Data\Objects\ObjectContext.cs (8)
564
key = this.ObjectStateManager.CreateEntityKey(entitySet, wrappedEntity.
Entity
);
571
if (!Object.ReferenceEquals(existingEntry.Entity, wrappedEntity.
Entity
))
668
EntityEntry entry = this.ObjectStateManager.FindEntityEntry(wrappedEntity.
Entity
);
701
Debug.Assert(wrappedEntity.
Entity
!= null, "The entity must not be null.");
977
ose.UpdateOriginalValues(wrappedOriginalEntity.
Entity
);
1096
Debug.Assert(wrappedEntity.
Entity
!= null, "entity shouldn't be null");
1112
key = this.ObjectStateManager.CreateEntityKey(entitySet, wrappedEntity.
Entity
);
1166
Debug.Assert(!Object.ReferenceEquals(entry.Entity, wrappedEntity.
Entity
));
System\Data\Objects\ObjectStateManager.cs (34)
310
var actualType = wrappedEntity.
Entity
.GetType();
332
Debug.Assert(wrappedObject.
Entity
!= null, "entity cannot be null.");
351
throw EntityUtil.EntityTypeDoesNotMatchEntitySet(wrappedObject.
Entity
.GetType().Name, TypeHelpers.GetFullName(entitySet), argumentName);
389
((dataObjectEntityKey == null && (null != (existingEntry = FindEntityEntry(wrappedObject.
Entity
)))) ||
392
if (existingEntry.Entity != wrappedObject.
Entity
)
696
Debug.Assert(wrappedEntity.
Entity
!= null, "entity cannot be null.");
752
this.TransactionManager.PromotedKeyEntries.Add(wrappedEntity.
Entity
, keyEntry);
760
Debug.Assert(wrappedEntity.
Entity
!= null);
782
pair.Key.OnAssociationChanged(CollectionChangeAction.Remove, wrappedEntity.
Entity
);
836
!Object.ReferenceEquals(relatedReference.ReferenceValue.
Entity
, wrappedTarget.
Entity
))
849
if (currentWrappedTarget != null && currentWrappedTarget.
Entity
!= null && currentWrappedTarget != wrappedTarget)
1391
if (entry.WrappedEntity.
Entity
!= null)
1411
Debug.Assert(wrappedObject.
Entity
!= null, "entity cannot be null.");
1457
Debug.Assert(wrappedEntity.
Entity
!= null, "Cannot verify key for null entity.");
1489
object entityValue = typeMetadata.Member(ordinal).GetValue(wrappedEntity.
Entity
);
2662
if (relationshipManager.WrappedOwner.
Entity
!= entity)
2725
if (fireEvent && wrappedEntity.
Entity
!= null && !TransactionManager.IsAttachTracking)
2728
OnEntityDeleted(CollectionChangeAction.Remove, wrappedEntity.
Entity
);
2729
OnObjectStateManagerChanged(CollectionChangeAction.Remove, wrappedEntity.
Entity
);
2963
if (null != wrappedEntity && null != wrappedEntity.
Entity
&& !(wrappedEntity.
Entity
is IEntityWithKey))
2965
_keylessEntityStore.Remove(wrappedEntity.
Entity
);
3256
EntityEntry relatedEntry = FindEntityEntry(addedEntity.
Entity
);
3296
entityKey = this.CreateEntityKey(this.GetEntitySetOfOtherEnd(entityFrom, relatedEndFrom), entityTo.
Entity
);
3378
relatedEntry.WrappedEntity.
Entity
!= null)
3433
TransactionManager.EntityBeingReparented = targetReference.GetDependentEndOfReferentialConstraint(targetReference.ReferenceValue.
Entity
);
3441
TransactionManager.EntityBeingReparented = reference.GetDependentEndOfReferentialConstraint(reference.ReferenceValue.
Entity
);
3501
relatedEntry.WrappedEntity.
Entity
!= null)
3513
relatedEntry.WrappedEntity.
Entity
!= null)
3536
TransactionManager.EntityBeingReparented = reference.GetDependentEndOfReferentialConstraint(reference.ReferenceValue.
Entity
);
3572
TransactionManager.EntityBeingReparented = reference.GetDependentEndOfReferentialConstraint(reference.ReferenceValue.
Entity
);
3657
reference = wrappedEntity.
Entity
== null ?
3662
if (wrappedEntity.
Entity
!= null && reference != null)
System\Data\Objects\RelationshipEntry.cs (3)
510
if (wrappedEntity1.
Entity
!= null && wrappedEntity2.
Entity
!= null)
526
if (wrappedEntity1.
Entity
== null)