views:

184

answers:

2

I am trying to find the syntax for changing the automap behavior of Fluent NHibernate.

How would I modify the code below to map the UserId property to a column named UserIdentifier (as an example)?

public class MyTypeMap : ClassMap<MyType>
{
    public MyTypeMap()
    {
            Table("MyTypes");
            Id(x => x.InstanceId).GeneratedBy.Guid().UnsavedValue(Guid.Empty);
            Map(x=> x.UserId);
    }
}

Thanks

A: 
public class MyTypeMap : ClassMap<MyType>
{
   public MyTypeMap()
   {
        Id (x => x.InstanceId).Column ("UserIdentifier").GeneratedBy.Guid().UnsavedValue(Guid.Empty);
   }
}
Frederik Gheysels
why the downgrade ? This is perfectly ok.
Frederik Gheysels
+1  A: 
public class MyTypeMap : ClassMap<MyType>
{
    public MyTypeMap()
    {
            Table("MyTypes");
            Id(x => x.InstanceId).GeneratedBy.Guid().UnsavedValue(Guid.Empty);
            Map(x=> x.UserId).Column("UserIdentifier");
    }
}
Chris
many thanks for rapid response
Ben Aston

related questions