Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test for issue #22092 #22111

Merged
1 commit merged into from
Aug 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions test/EFCore.Specification.Tests/DataAnnotationTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2439,25 +2439,38 @@ protected override void Seed(PoolableDbContext context)
}
}

protected abstract class OneBase
{
public virtual int UniqueNo { get; set; }

public virtual Guid RowVersion { get; set; }

public virtual string IgnoredProperty { get; set; }

public virtual string RequiredColumn { get; set; }

public virtual string MaxLengthProperty { get; set; }
}

[Table("Sample")]
protected class One
protected class One : OneBase
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int UniqueNo { get; set; }
public override int UniqueNo { get; set; }

[ConcurrencyCheck]
public Guid RowVersion { get; set; }
public override Guid RowVersion { get; set; }

[NotMapped]
public string IgnoredProperty { get; set; }
public override string IgnoredProperty { get; set; }

[Required]
[Column("Name")]
public string RequiredColumn { get; set; }
public override string RequiredColumn { get; set; }

[MaxLength(10)]
public string MaxLengthProperty { get; set; }
public override string MaxLengthProperty { get; set; }

public Details Details { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,16 @@ public override ModelBuilder DatabaseGeneratedOption_configures_the_property_cor
return modelBuilder;
}

[ConditionalFact]
public virtual void ColumnAttribute_configures_the_property_correctly()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.Entity<One>();

Assert.Equal("Name",
modelBuilder.Model.FindEntityType(typeof(One)).FindProperty(nameof(One.RequiredColumn)).GetColumnName());
}

public override ModelBuilder DatabaseGeneratedOption_Identity_does_not_throw_on_noninteger_properties()
{
var modelBuilder = base.DatabaseGeneratedOption_Identity_does_not_throw_on_noninteger_properties();
Expand Down