views:

23

answers:

0

Hello

I'm using fluent nhibernate v. 1.0.0.595. There is a class:

public class Weight
{
    public virtual int Id { get; set; }
    public virtual double Value { get; set; }
}

I want to map it on the following table:

 create table [Weight] (
    WeightId INT IDENTITY NOT NULL,
   Weight DOUBLE not null,
   primary key (WeightId)
)

Here is the map:

public class WeightMap : ClassMap<Weight>
{
    public WeightMap()
    {
        Table("[Weight]");
        Id(x => x.Id, "WeightId");
        Map(x => x.Value, "Weight").Not.Nullable();
    }
}

The problem is that this mapping produces table with nullable Weight column:

Weight DOUBLE null

Not-nullable column is generated only with default convention for column name (i.e. Map(x => x.Value).Not.Nullable() instead of Map(x => x.Value, "Weight").Not.Nullable()), but in this case there will be Value column instead of Weight:

 create table [Weight] (
    WeightId INT IDENTITY NOT NULL,
   Value DOUBLE not null,
   primary key (WeightId)
)

I found similiar problem here: http://code.google.com/p/fluent-nhibernate/issues/detail?id=121, but seems like mentioned workaround with SetAttributeOnColumnElement("not-null", "true") is outdated. Does anybody encountered with this problem? Is there a way to specify named column as not-nullable?