Thanks for the hint in the right direction, however it seems like the
convention is overriding my "manual" overrides.
public class NotNullPropertyConvention : IPropertyConvention
{
public bool Accept(IProperty target)
{
return true;
}
public void Apply(IProperty target)
{
target.Not.Nullable();
}
}
.ConventionDiscovery.Add<NotNullPropertyConvention>()
.ForTypesThatDeriveFrom<Participant>(map =>
{
map.Map(x => x.BarCode).Nullable();
map.Map(x => x.Country).Nullable();
map.Map(x => x.Title).Nullable();
})
The Participant-table gets not null on all properties including
BarCode, Country and Title.
This feels odd, or am I doing something strange?
> convention<
http://wiki.fluentnhibernate.org/show/Conventions>to set
> everything to null, then you have a few options for how to handle the
> not null ones.
> something like:
>
> public class NullPropertyConvention : IPropertyConvention
> {
> public bool Accept(IProperty target)
> {
> return true;
> }
>
> public void Apply(IProperty target)
> {
> target.Nullable();
> }
>
> }
>
> then for the not nulls, you can either override them on the
> AutoPersistenceModel<
http://wiki.fluentnhibernate.org/show/AutoMappingAlteringEntities>
> :
>
> .ForTypesThatDeriveFrom<MyEntity>(m =>
> m.Map(x => x.MyProperty)
> .Not.Nullable());
>
> or you can use an automapping
> override<
http://wiki.fluentnhibernate.org/show/AutoMappingOverrides>
> :