I have the following classes:
public DbSet<Request> Requests { get; set; }
public DbSet<Answer> Answers { get; set; }
being that 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 purposes, it turns out that I created another classCategory
and set up a relation many-to-many with the class (database table) Request
, to my surprise, the new class was included in the migration, without my having identified it as DbSet
. My question is this: if I create a new class X and it somehow relates to a class Y in DbSet
then class X is added to the database automatically? In my case, you could remove this line:
public DbSet<Answer> Answers { get; set; }
without changing the behavior? (this class is related to the Request
class).