Table relation with itself
See original GitHub issueI have a table that joined with itself, like this :
public class Stuff
{
public int Id { get; set; }
public string? Title{ get; set; }
public int ChildId { get; set; }
public virtual ICollection<Stuff> Stuffs{ get; set; }
}
But when I use Scaffold, It makes two classes like this :
public class Stuff
{
public stringId { get; set; }
public string? Title{ get; set; }
public string ChildId { get; set; }
public virtual ICollection<Stuff> Stuffs{ get; set; }
}
public class Stuff1
{
public int Id { get; set; }
public string? Title{ get; set; }
public int ChildId { get; set; }
public virtual ICollection<Stuff> Stuffs{ get; set; }
}
How can I fix this issue?
Provide technical details
- EF Core version in use: EF Core 7
- Is Handlebars used: yes
- Is T4 used: yes
- Is .dacpac used: yes
- EF Core Power Tools version: 2.5.1277
- Database engine: SQL Server
- Visual Studio version: Visual Studio 2022
Issue Analytics
- State:
- Created 8 months ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
SQL table: create 1-to-1 relationship with itself?
I want to create a 1-to-1 relationship on a table with itself. I have a table MenuItem , but I want the items...
Read more >Types of Relationships :: Chapter 10. Table Relationships
A table bears a self-referencing relationship (also known as a recursive relationship) to itself when a given record in the table is related...
Read more >Relationships in SQL - Complete Guide With Examples
A self-referencing relationship (also known as a recursive relationship) in a database occurs when a column in a table relates to another column ......
Read more >Self-relations - Prisma
A relation field can also reference its own model, in this case the relation is called a self-relation. Self-relations can be of any...
Read more >Defining a table's relationship ... to itself
I have a table consisting of the Event Ids and a 'Related' Id, which is of course simply the Id of another event....
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 FreeTop 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
Top GitHub Comments
Ping?
Please share your CREATE TABLE script