Hello I've refered to the help as you suggested:
FK-PK synchronization
_
This synchronization of FK-PK values is already done at the moment you set a property to a reference of an entity object, for example myOrder.Customer = myCustomer, if the entity (in this case myCustomer) is not new. Synchronization is also performed after a save action, so identity/sequenced columns are also synchronized_
However i'm getting the following error:
An exception was caught during the execution of an action query: Cannot insert the value NULL into column 'ContactID', table 'devre.dbo.Employee'; column does not allow nulls. INSERT fails.
The statement has been terminated.. Check InnerException, QueryExecuted and Parameters of this exception to examine the cause of this exception.
The code I am trying to use looks like this:
Dim emp As New EmployeeEntity()
Dim con As New ContactInformationEntity()
con.FirstName = "First"
con.LastName = "Last"
con.BuildingNumber = "123"
con.StreetName = "Fake"
con.StreetSuffix = "Street"
con.City = "CityName"
con.State = "ST"
con.ZipCode = "12345"
con.ZipCodePlusFour = "1234"
emp.ContactInformation = con
emp.LicenseNumber = "ABCDE"
emp.DateStarted = DateTime.Now
emp.Save()
My tables resemble this:
Employee
EmployeeID PK
ContactID FK
LicenseNumber
DateStarted
ContactInformation
ContactID PK
FirstName
LastName
etc.
Should I be creating the ContactInformation and saving it seperately then when I want to insert into Employee do: emp.ContactID = con.ContactID?
This software seems like it could save me alot of time, if I can figure out how to use it! Thanks very much for your help I really appreciate it.
-Kas