How to insert into 3 tables that were created by TPT?

54 Views Asked by At

I have 3 tables like this:

public class User
{
    public long Id { get; set; }
    public string FirstName { get; set; }
    public string LastName { get; set; }

}

public class FeaturedUser:User
{
    public int ScoreRate { get; set; }

}
public class NormalUser : User
{
    public int Age { get; set; }
    public Gender Gender { get; set; }  

}

Also there is a form in which I can add a new User. in that form there is 2 checkboxes like this:

  • Is Featured User
  • Is Normal User

If in worst case user will check all check-boxes and I will expect to have same company with 2 sets of additional attributes. My question is how can I Insert into these 3 tables, in a way I would have 1 user with 2 relations with "featuredUser" and "NormalUser". But if I Insert a featured user and then insert a normal user I would have 2 user rows same as each other and 2 distinct "featuredUser" and "NormlUser".

0

There are 0 best solutions below