Do you mean One to Many?

convention.OneToManyConvention = m =>
{
    m.Cascade.All();
};

On Feb 11, 1:58 pm, Ramana Kumar <[email protected]> wrote:
> Hi
> I am trying to use AutoMap to define behaviour for ManyToOne and I get the
> following exception
>
> object references an unsaved transient instance - save the transient
> instance before flushing:
>
> The relevant code is
>
>  public class AutoPersistenceModelGenerator : IAutoPersistenceModelGenerator
>     {
>         public AutoPersistenceModel Generate()
>         {
>             AutoPersistenceModel mappings = AutoPersistenceModel
>                 .MapEntitiesFromAssemblyOf<Golfer>()
>                 .Where(GetAutoMappingFilter)
>                 .WithConvention(GetConventions);
>             return mappings;
>         }
>
>         private bool GetAutoMappingFilter(Type t)
>         {
>             return t.Namespace == "GolfHandicapManager.Core";
>         }
>         private void GetConventions(Conventions c)
>         {
>             c.GetPrimaryKeyNameFromType = type => "ROW_ID";  //DB has ROW_ID
> as Primary Key
>             c.FindIdentity = type => type.Name == "ID"; // S#arp currently
> uses "ID"
>             // Taken from Ayende Blog
>             c.GetForeignKeyNameOfParent = (type => type.Name + "_ID");
>             c.GetTableName = type =>
> Inflector.Net.Inflector.Pluralize(type.Name);
>             c.IsBaseType = IsBaseTypeConvention;
>             // Convert PropertyName to Underscore
>             c.AddPropertyConvention(new
> PascalToUnderscorePropertyConvention());
>         }
>
> I am assuming I have to do a "cascade=all" somewhere in there but do not
> know how to do it thru a convention.
>
> Any pointers?
> Thanks
> Ramana
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to