I kinda stumbled on the solution to my problem. However it's somewhat
of a hack.
I've confirmed that this code works for Create Read and Update:
public void Override( AutoMap<Configuration> mapping )
{
mapping.WithTable( "xCoreConfiguration" );
mapping.IgnoreProperty( c => c.Application );
mapping.IgnoreProperty( c => c.Key );
mapping.UseCompositeId()
.WithKeyReference( c => c.Application,
"FK_xCoreApplicationId" )
.WithKeyProperty( c => c.Key );
}
Previously I stated that I had to have mapping.References(...)
otherwise I would get an error
This code generates fails because it attempted to map the Application
ID twice
public void Override( AutoMap<Configuration> mapping )
{
mapping.WithTable( "xCoreConfiguration" );
mapping.UseCompositeId()
.WithKeyReference( c => c.Application,
"FK_xCoreApplicationId" )
.WithKeyProperty( c => c.Key );
}
select configurat0_.FK_xCoreApplicationId as FK1_1_,
configurat0_.Key as Key1_,
configurat0_.Value as Value1_,
configurat0_.CreatedByUser as CreatedB4_1_,
configurat0_.CreatedOnDate as CreatedO5_1_,
configurat0_.ModifiedByUser as Modified6_1_,
configurat0_.ModifiedOnDate as Modified7_1_,
configurat0_.Application_id as Applicat8_1_
from xCoreConfiguration configurat0_
where (configurat0_.FK_xCoreApplicationId = ?)
and (configurat0_.Key = ?)
Adding the mapping.References(...) corrected the mapping of the second
instance of Application ID. By adding mapping.IgnoreProperty( c =>
c.Application ), the second reference to Application ID is removed
altogether.
Joy.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---