1
I have the following classes:
public DbSet<Request> Requests { get; set; }
public DbSet<Answer> Answers { get; set; }
where they have a one-to-Many relationship.
When I want a class to be added to my Entityframework migration model, I have to add it as I have in the above code, for mapping reasons, it turns out I created another class Category
and set up a Many-to-Many relationship with the class (table in the database) Request
, to my surprise, the new class was included in the migration, without me having identified it as DbSet
. My question is this: whether I create a new class X and it somehow relates to a class Y in the DbSet
then class X is added to the database automatically? In my case, could you remove this line:
public DbSet<Answer> Answers { get; set; }
without changing the behavior? (this class is related to the class Request
).
Thank you! That’s right
– ihavenokia