Hey guys,
I have an issue where our legacy database model isn't exactly
normalized- we have a list of Projects that need a County associated
with them. In the Counties database we have a CountyID for the
Primary Key, but in the Projects database we do not-- I need to map
the County and Location_State columns from the Projects database
against CountyName and StateAlphaCode in the Counties database.
In ProjectMap.CS I have:
References<County>(x => x.County, "Location_State").PropertyRef(x =>
x.StateCode);
CountyMap if you need it:
public CountyMap()
{
WithTable("Counties");
Id(x => x.ID, "CountyID")
.WithUnsavedValue(0)
.GeneratedBy.Assigned();
Map(x => x.Name, "CountyName");
Map(x => x.StateCode, "StateAlphaCode");
}
This is the generated SQL:
FROM Projects this_ left outer join Counties county1_ on
this_.Location_State=county1_.StateAlphaCode
I need it to have the CountyName in there too, so this is what I need
it to generate this:
FROM Projects this_ left outer join Counties county1_ on
this_.Location_State=county1_.StateAlphaCode AND
this_.County=county1_.CountyName.
I need a way to do 2 PropertyRef, but that fails on a Reference
already defined. So the question is, how to I map a Many to 1 against
an object where I'm NOT using its ID?
Thank you in advance,
-Dallas
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Fluent NHibernate" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/fluent-nhibernate?hl=en
-~----------~----~----~----~------~----~------~--~---