I set up a database with ef core code first management. I have two related tables.I want to insert data into a table. but since it has a relationship with the other table, it tries to throw data into the other table. whereas I only want to record a table. how do i do this?
code:
- table
public class JobTable
{
[Key]
public int ID_JOB { get; set; }
public JobType JobType { get; set; }
public string JOB_KEY { get; set; }
public TimeSpan JOB_TIME { get; set; }
public int? DAY { get; set; }
public Boolean IS_ACTIVE { get; set; }
public string? DESCRIPTION { get; set; }
public CustomUser CustomUser { get; set; }
}
- table:
public class JobType
{
[Key]
public int ID_JOB_TYPE { get; set; }
public string JOB_TYPE_NAME { get; set; }
public List<JobTable> jobTable { get; set; }
}
ef code:
context.JobTable.Add(jobTable);
context.SaveChanges();
i just want to add data to 'jobtable' table. but it tries to throw data into the 'jobtype' table as well, since it is related to the 'jobtype' table. idont want this. how can I do it?