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