IsRequired(false) created same field name with additional 1
See original GitHub issuepublic class Table1
{
public int Table1Id { get; set; }
public string Name { get; set; }
public virtual ICollection<Table2> MyTables { get; set; }
}
public class Table2
{
public int Table2Id { get; set; }
public int Table1Id { get; set; }
[ForeignKey("Table1Id")]
public virtual Table1 Table1 { get; set; }
}
protected override void OnModelCreating(ModelBuilder builder)
{
builder.Entity<Table1>()
.HasMany(e => e.MyTables)
.WithOne(e => e.Table1)
.IsRequired(false);
}
PostgresException: 42703: column t.Table1Id1 does not exist
The above code generated additional field that is invalid. Removing false in IsRequired() will operate normally. I am currently using Npgsql.EntityFrameworkCore.PostgreSQL v2.1.1.
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (1 by maintainers)
Top Results From Across the Web
IsRequired(false) created same field name with additional 1
The above code generated additional field that is invalid. Removing false in IsRequired() will operate normally. I am currently using Npgsql.
Read more >how do i make IsRequired field to false to in mvc?
I have one project in mvc. i have employee model file with me that's is an dll file code. which defines all the...
Read more >One-to-one relationships - EF Core
One -to-one relationships are used when one entity is associated with at most one other entity. For example, a Blog has one BlogHeader ......
Read more >Form fields
If a Field has required=False and you pass clean() an empty value, then clean() will return a normalized empty value rather than raising...
Read more >dataclasses — Data Classes — Python 3.11.4 documentation
One possible reason to set hash=False but compare=True would be if a field is expensive to compute a hash value for, that field...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
It seems unlikely to me that this would be intentional, so a warning makes sense to me.
I get that there is a compromise, but to me this one seems to be on the border of being invalid configuration. Do you think the chances that anyone would do this on purpose are high? I don’t, but maybe I am missing something.