public void HasEntitySetName_configures() { var type = typeof(LocalEntityType); var innerConfig = new EntityTypeConfiguration(type); var config = new ConventionTypeConfiguration <LocalEntityType>(type, () => innerConfig, new ModelConfiguration()); config.HasEntitySetName("foo"); Assert.Equal("foo", innerConfig.EntitySetName); }
public void HasEntitySetName_evaluates_preconditions() { var type = new MockType(); var innerConfig = new EntityTypeConfiguration(type); var config = new ConventionTypeConfiguration(type, () => innerConfig, new ModelConfiguration()); var ex = Assert.Throws<ArgumentException>( () => config.HasEntitySetName(null)); Assert.Equal(Strings.ArgumentIsNullOrWhitespace("entitySetName"), ex.Message); }
public void HasEntitySetName_evaluates_preconditions() { var type = new MockType(); var innerConfig = new EntityTypeConfiguration(type); var config = new ConventionTypeConfiguration(type, () => innerConfig, new ModelConfiguration()); var ex = Assert.Throws <ArgumentException>( () => config.HasEntitySetName(null)); Assert.Equal(Strings.ArgumentIsNullOrWhitespace("entitySetName"), ex.Message); }
public void HasEntitySetName_configures_when_unset() { var type = new MockType(); var innerConfig = new EntityTypeConfiguration(type); var config = new ConventionTypeConfiguration(type, () => innerConfig, new ModelConfiguration()); var result = config.HasEntitySetName("EntitySet1"); Assert.Equal("EntitySet1", innerConfig.EntitySetName); Assert.Same(config, result); }
/// <summary> /// Configures the entity set name to be used for this entity type. /// The entity set name can only be configured for the base type in each set. /// </summary> /// <param name="entitySetName"> The name of the entity set. </param> /// <returns> /// The same <see cref="ConventionTypeConfiguration{T}" /> instance so that multiple calls can be chained. /// </returns> /// <remarks> /// Calling this will have no effect once it has been configured. /// </remarks> public ConventionTypeConfiguration <T> HasEntitySetName(string entitySetName) { _configuration.HasEntitySetName(entitySetName); return(this); }
public void HasEntitySetName_configures() { var type = typeof(LocalEntityType); var innerConfig = new EntityTypeConfiguration(type); var config = new ConventionTypeConfiguration<LocalEntityType>(type, () => innerConfig, new ModelConfiguration()); config.HasEntitySetName("foo"); Assert.Equal("foo", innerConfig.EntitySetName); }