I have 3 tables: Job, Schedules and job_schedules which is the connection table, holding job_id and schedule_id for many to many connection. I currently use Entity Framework for importing the tables and creating the data model. The issue i'm facing is that when I import the job_schedules table, only a connection between job and schedules is made, no entity is defined in the model. How can I make the import create an entity in the model not just a many to many connection between the two tables?
            Asked
            
        
        
            Active
            
        
            Viewed 119 times
        
    0
            
            
        - 
                    Is this code first or database first? http://stackoverflow.com/questions/7050404/create-code-first-many-to-many-with-additional-fields-in-association-table – Steve Greene Jun 15 '16 at 14:59
1 Answers
0
            
            
        I'm quite sure you can add the DbSet to your DataContext manualy.
You'll need the model itself:
[Table("tableName")]    
public class JobSchedule()
    {
        //yourproperties with [Column("Name")] atribute
    }
And the reference in the DbContext:
DbSet<JobSchedule> JobSchedules = new DbSet<JobSchedule>()
And my advice is to use Migrations in the future, and the workflow will be much easier.
 
    
    
        Alex
        
- 3,689
- 1
- 21
- 32
