public void TableAttribute_sets_column_name_order_and_type_with_conventional_builder() { var modelBuilder = new ModelBuilder(TestConventionalSetBuilder.Build()); var entityBuilder = modelBuilder.Entity <A>(); Assert.Equal("MyTable", entityBuilder.Metadata.Relational().TableName); Assert.Equal("MySchema", entityBuilder.Metadata.Relational().Schema); }
public void ColumnAttribute_sets_column_name_and_type_with_conventional_builder() { var modelBuilder = new ModelBuilder(TestConventionalSetBuilder.Build()); var entityBuilder = modelBuilder.Entity <A>(); Assert.Equal("Post Name", entityBuilder.Property(e => e.Name).Metadata.Relational().ColumnName); Assert.Equal("DECIMAL", entityBuilder.Property(e => e.Name).Metadata.Relational().ColumnType); }
public override void Detects_duplicate_columns_in_derived_types_with_different_types() { var modelBuilder = new ModelBuilder(TestConventionalSetBuilder.Build()); modelBuilder.Entity <Animal>(); modelBuilder.Entity <Cat>(); modelBuilder.Entity <Dog>(); VerifyError(RelationalStrings.DuplicateColumnName(typeof(Cat).Name, "Type", typeof(Dog).Name, "Type", "Type", ".Animal", "TEXT", "INTEGER"), modelBuilder.Model); }
public virtual void Does_not_detect_duplicate_column_names_within_hierarchy() { var modelBuilder = new ModelBuilder(TestConventionalSetBuilder.Build()); modelBuilder.Entity <Animal>(); modelBuilder.Entity <Cat>(); modelBuilder.Entity <Dog>(); Validate(modelBuilder.Model); }
public override void Detects_duplicate_column_names() { var modelBuilder = new ModelBuilder(TestConventionalSetBuilder.Build()); modelBuilder.Entity <Animal>().Property(b => b.Id).ForSqlServerHasColumnName("Name"); VerifyError(RelationalStrings.DuplicateColumnNameDataTypeMismatch(nameof(Animal), nameof(Animal.Id), nameof(Animal), nameof(Animal.Name), "Name", nameof(Animal), "int", "nvarchar(max)"), modelBuilder.Model); }
public virtual void Detects_duplicate_column_names_within_hierarchy_with_different_unicode() { var modelBuilder = new ModelBuilder(TestConventionalSetBuilder.Build()); modelBuilder.Entity <Animal>(); modelBuilder.Entity <Cat>().Ignore(e => e.Type).Property(c => c.Breed).IsUnicode(false); modelBuilder.Entity <Dog>().Ignore(e => e.Type).Property(d => d.Breed).IsUnicode(); VerifyError(RelationalStrings.DuplicateColumnNameDataTypeMismatch( nameof(Cat), nameof(Cat.Breed), nameof(Dog), nameof(Dog.Breed), nameof(Cat.Breed), nameof(Animal), "varchar(max)", "nvarchar(max)"), modelBuilder.Model); }
public override void Detects_duplicate_column_names_within_hierarchy_with_different_MaxLength() { var modelBuilder = new ModelBuilder(TestConventionalSetBuilder.Build()); modelBuilder.Entity <Animal>(); modelBuilder.Entity <Cat>().Ignore(e => e.Type).Property(c => c.Breed).HasMaxLength(30); modelBuilder.Entity <Dog>().Ignore(e => e.Type).Property(d => d.Breed).HasMaxLength(15); VerifyError(RelationalStrings.DuplicateColumnNameDataTypeMismatch( nameof(Cat), nameof(Cat.Breed), nameof(Dog), nameof(Dog.Breed), nameof(Cat.Breed), nameof(Animal), "nvarchar(30)", "nvarchar(15)"), modelBuilder.Model); }
public override void Detects_duplicate_columns_in_derived_types_with_different_types() { var modelBuilder = new ModelBuilder(TestConventionalSetBuilder.Build()); modelBuilder.Entity <Animal>(); modelBuilder.Entity <Cat>().Property(c => c.Type); modelBuilder.Entity <Dog>().Property(c => c.Type); VerifyError(RelationalStrings.DuplicateColumnNameDataTypeMismatch( typeof(Cat).Name, "Type", typeof(Dog).Name, "Type", "Type", nameof(Animal), "nvarchar(max)", "int"), modelBuilder.Model); }