Dear Flavio,
I run the sample and get the same issue.
You can fix it in the "[InstalledDirs]\Molds\NHibernateMold\EntityRepository.tt"
By replace from line 82 to 87 with the following:
var original<#= Entity.Name #> = Get<#= Entity.Name #>(<#= GetRepositoryPrimaryKeysWithoutTypes(Entity,Entity.Name) #>);
<#
foreach (Association association in SculptureModel.Store.ElementDirectory.FindElements<Association>())
{
if(Entity == association.TargetEntity)
{
if(association.EndOneMultiplicity == Dawliasoft.Sculpture.Multiplicity.One)
{
#>
original<#= Entity.Name #>.<#= association.EndTwoRole #> = <#= ToCamel(Entity.Name) #>.<#= association.EndTwoRole #>;
<#
}
}
if(Entity == association.SourceEntity)
{
if(association.EndTwoMultiplicity == Dawliasoft.Sculpture.Multiplicity.One)
{
#>
original<#= Entity.Name #>.<#= association.EndOneRole #> = <#= ToCamel(Entity.Name) #>.<#= association.EndOneRole #>;
<#
}
}
}
#>
if(<#= ToCamel(Entity.Name) #>.EntityState == System.Data.EntityState.Added)
{
_objectContext.Detach(<#= ToCamel(Entity.Name) #>);
attachingFlag = true;
}