views:

42

answers:

1

Hi using fluentnibernate automappings

to map this

    public virtual int Id { get; set; }
    /*...snip..*/
    public virtual MapMarkerIcon MapMarkerIcon { get; set; }
}

to this

CREATE TABLE [Attraction](
    [Id] [int] IDENTITY(1,1) NOT NULL,
    [MapMarkerIconId] [int] NULL
)

with this:

var cfg = Fluently.Configure()


            .Database(MsSqlConfiguration.MsSql2005.ConnectionString(connectionString)
                .DefaultSchema("xxx"))

            .Mappings(m =>
                          {
                              m.AutoMappings
                                  .Add(
                                  AutoMap.AssemblyOf<Partner>().Where(
                                      n => n.Namespace == "xxx.Core.Domain")

                                  );

                              m.FluentMappings.Conventions.Add(PrimaryKey.Name.Is(x => "Id"),
                                                               DefaultLazy.Always(),
                                                               ForeignKey.EndsWith("Id")
                                  );
                          }


            )

            .ExposeConfiguration(c => c.SetProperty(Environment.ReleaseConnections, "on_close"))
            .ExposeConfiguration(c => c.SetProperty(Environment.ProxyFactoryFactoryClass, typeof(ProxyFactoryFactory).AssemblyQualifiedName))
            .BuildConfiguration();

Why do I get

Server Error in '/XXX.Web' Application. Invalid column name 'MapMarkerIcon_id'.

How can I make fluentnibernate use MapMarkerIconId instead of MapMarkerIcon_id?

related questions