I have two models and first model has a property ICollection. I have one to many relationship between them and I defined that using fluent
I have two models and first model has a property ICollection. I have one to many relationship between them and I defined that using fluent API (using entity framework). But in SQL server I am only seeing first model's table populate with data. The second model's table does not populate as I insert data. Here is more details:
Model 1:
public class Model1{
public int? PersonId { get; set; } public string LastName { get; set; } public string FirstName { get; set; }
public virtual ICollection model2 { get; set; }
}
Model 2:
public class Model2{
public int? Id { get; set; } public int PersonId { get; set; } public int number { get; set; }
}
Fulent API:
modelBuilder.Entity
I have a feeling I am supposed to put something inside WithRequired()?
why is the table for not populating?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started