I am sure this is a straightforward question but consider the following: I have a reference between company and sector as follows:
public class Company {
public Guid ID { get; set; }
public Sector Sector { get; set; }
public Guid SectorID { get; set; }
}
public class Sector {
public Guid ID { get; set; }
public string Name { get; set; }
}
Ok. What I want is the SectorID of the Company object to be populated after I go: (new Company()).Sector = new Sector() { Name="asdf" } and do a flush.
The mapping I am using kindly creates an additional column in the database called Sector_Id in the Company table, but this is not available as a property on Company. I want the SectorID property to be filled.
The mapping i am currently using in the CompanyMap is References(c => c.Sector).Cascade.All();
Does anyone have any ideas?