c# - How to use Fluent API to map foreign key -
I am trying to use ModelBuilder to map foreign keys to my database I need to post an ID in JobTESPM_EmployeeId instead of JOBTESPMId. I am using it as a guide, but I do not know that the examples are similar to my setup.
public class jobs {[Key] [Database GeneratedAttivate (Database Generation. Non)] Public Int64? JOBDE {Get; Set; } Public int? Job (number); Set; } Public String JobName {get; Set; } Public int? Get a Job ID; Set; } Public int? Customer Emporium PMIID {Received; Set; } Public virtual client employee employee employee employee {MM; Set; } Public int? Customer ImperiumID {Receive; Set; } Public Virtual Customer Employee Employee Employee Employee {Receive; Set; } Public int? The right set of customer employee bureaucracy; } Public virtual customer employee employee employee employee (receipt); Set; } Public int? Receive Customer Employee Employee Warranty ID { Set; } Receive the Public Virtual Customer Employee Employee Customer Employee Warranty; Set; } Public int? Jobteaspirid {Received; Set; } Public Virtual Workers Jobsepsm {Receiving; Set; } Public int? JobTESSuperintendentId {get; Set; } Public Virtual Employee Jobteaspress Representatives {get; Set; }} Public Class Employees {Public Ent Empire {get; Set; } Public string accountName {get; Set; } Public string EmployeeFirstName {get; Set; } Public String EmployeeListName {get; Set; } Public string EmployeeTitle {get; Set; } Public Int64? Employee cellphone {receive; Set; } Public Int64? Receive the employee's office phone; Set; } Public String EmployeeEmail {get; Set; } Public int? Company Receipt {IMOD} Set; } Public bool? Employees Vested {Receipts; Set; } Public bool? Employee Isuper {get; Set; } Public bool? Employee ISPM {Receive; Set; } Public String EmployeeAltEmail {get; Set; }}
What about adding some properties ...
[column ("JOBTSPM_AMPLIID")] Public Int? Jobteaspirid {Received; Set; } [Foreign ("Jobtepsimid")] Public Virtual Worker Jobs (Receipt; Set; }
Comments
Post a Comment