// <summary> // Creates an instance of <see cref="DbEntityValidationResult" /> class. // </summary> // <param name="entry"> Entity entry the results applies to. Never null. </param> // <param name="validationErrors"> // List of <see cref="DbValidationError" /> instances. Never null. Can be empty meaning the entity is valid. // </param> internal DbEntityValidationResult(InternalEntityEntry entry, IEnumerable<DbValidationError> validationErrors) { DebugCheck.NotNull(entry); DebugCheck.NotNull(validationErrors); _entry = entry; _validationErrors = validationErrors.ToList(); }
/// <summary> /// Creates an instance of <see cref = "DbEntityValidationResult" /> class. /// </summary> /// <param name = "entry"> /// Entity entry the results applies to. Never null. /// </param> /// <param name = "validationErrors"> /// List of <see cref = "DbValidationError" /> instances. Never null. Can be empty meaning the entity is valid. /// </param> internal DbEntityValidationResult(InternalEntityEntry entry, IEnumerable<DbValidationError> validationErrors) { Contract.Requires(entry != null); Contract.Requires(validationErrors != null); _entry = entry; _validationErrors = validationErrors.ToList(); }
/// <summary> /// Creates an instance of <see cref="DbEntityValidationResult" /> class. /// </summary> /// <param name="entry"> Entity entry the results applies to. Never null. </param> /// <param name="validationErrors"> /// List of <see cref="DbValidationError" /> instances. Never null. Can be empty meaning the entity is valid. /// </param> public DbEntityValidationResult(DbEntityEntry entry, IEnumerable<DbValidationError> validationErrors) { Check.NotNull(entry, "entry"); Check.NotNull(validationErrors, "validationErrors"); _entry = entry.InternalEntry; _validationErrors = validationErrors.ToList(); }
// <summary> // Creates a new <see cref="InternalMemberEntry" /> the runtime type of which will be // determined by the metadata. // </summary> // <param name="internalEntityEntry"> The entity entry to which the member belongs. </param> // <param name="parentPropertyEntry"> The parent property entry which will always be null for navigation entries. </param> // <returns> The new entry. </returns> public override InternalMemberEntry CreateMemberEntry( InternalEntityEntry internalEntityEntry, InternalPropertyEntry parentPropertyEntry) { Debug.Assert(parentPropertyEntry == null, "Navigation entries cannot be nested; parentPropertyEntry must be null."); return _isCollection ? (InternalMemberEntry)new InternalCollectionEntry(internalEntityEntry, this) : new InternalReferenceEntry(internalEntityEntry, this); }
public FakeInternalReferenceEntry(InternalEntityEntry internalEntityEntry, NavigationEntryMetadata navigationMetadata) : base(internalEntityEntry, navigationMetadata) { }
/// <summary> /// Creates a new <see cref = "InternalMemberEntry" /> the runtime type of which will be /// determined by the metadata. /// </summary> /// <param name = "internalEntityEntry">The entity entry to which the member belongs.</param> /// <param name = "parentPropertyEntry">The parent property entry if the new entry is nested, otherwise null.</param> /// <returns>The new entry.</returns> public override InternalMemberEntry CreateMemberEntry( InternalEntityEntry internalEntityEntry, InternalPropertyEntry parentPropertyEntry) { return parentPropertyEntry == null ? (InternalMemberEntry)new InternalEntityPropertyEntry(internalEntityEntry, this) : new InternalNestedPropertyEntry(parentPropertyEntry, this); }
/// <summary> /// Determines whether the specified <see cref = "InternalEntityEntry" /> is equal to this instance. /// Two <see cref = "InternalEntityEntry" /> instances are considered equal if they are both entries for /// the same entity on the same <see cref = "DbContext" />. /// </summary> /// <param name = "other">The <see cref = "InternalEntityEntry" /> to compare with this instance.</param> /// <returns> /// <c>true</c> if the specified <see cref = "InternalEntityEntry" /> is equal to this instance; otherwise, <c>false</c>. /// </returns> public bool Equals(InternalEntityEntry other) { if (ReferenceEquals(this, other)) { return true; } return !ReferenceEquals(null, other) && ReferenceEquals(_entity, other._entity) && ReferenceEquals(_internalContext, other._internalContext); }
public EntityValidator BuildEntityValidatorBase(InternalEntityEntry entityEntry) { return base.BuildEntityValidator(entityEntry); }
public EntityValidationContext GetEntityValidationContextBase( InternalEntityEntry entityEntry, IDictionary<object, object> items) { return base.GetEntityValidationContext(entityEntry, items); }
public PropertyValidator GetPropertyValidatorBase(InternalEntityEntry owningEntity, InternalMemberEntry property) { return base.GetPropertyValidator(owningEntity, property); }
public EntityValidator GetEntityValidatorBase(InternalEntityEntry entityEntry) { return base.GetEntityValidator(entityEntry); }
public void Doesnt_call_Equals_on_entity_object() { var mockInternalEntityEntry1 = new InternalEntityEntry( new Mock<InternalContextForMock> { CallBase = true }.Object, MockHelper.CreateMockStateEntry<GetHashCodeEntity>().Object); var mockInternalEntityEntry2 = new InternalEntityEntry( new Mock<InternalContextForMock> { CallBase = true }.Object, MockHelper.CreateMockStateEntry<GetHashCodeEntity>().Object); Assert.False(mockInternalEntityEntry1.Equals(mockInternalEntityEntry2)); }
/// <summary> /// Initializes a new instance of the <see cref="InternalEntityPropertyEntry" /> class. /// </summary> /// <param name="internalEntityEntry"> The internal entry. </param> /// <param name="propertyMetadata"> The property info. </param> public InternalEntityPropertyEntry( InternalEntityEntry internalEntityEntry, PropertyEntryMetadata propertyMetadata) : base(internalEntityEntry, propertyMetadata) { }
// <summary> // Initializes a new instance of the <see cref="InternalNavigationEntry" /> class. // </summary> // <param name="internalEntityEntry"> The internal entity entry. </param> // <param name="navigationMetadata"> The navigation metadata. </param> protected InternalNavigationEntry( InternalEntityEntry internalEntityEntry, NavigationEntryMetadata navigationMetadata) : base(internalEntityEntry, navigationMetadata) { }
public static EntityValidationContext CreateEntityValidationContext(InternalEntityEntry entityEntry) { return new EntityValidationContext(entityEntry, new ValidationContext(entityEntry.Entity, null, null)); }