我首先使用 Fluent nHibernate 代码,我有 Nullable 列,然后更改为 .Not.Nullable() 但我的列仍然是 Nullable
这是我的配置
public override void Load()
{
Bind<ISessionFactory>().ToMethod(x =>
{
var factory = Fluently.Configure()
.Database(MsSqlConfiguration.MsSql2008.ConnectionString
(c => c.FromConnectionStringWithKey("DefaultConnection")))
.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Users>()
.Conventions.Add(PrimaryKey.Name.Is(p => "Id"), ForeignKey.EndsWith("Id"))
.Conventions.Setup(c => c.Add(AutoImport.Never())))
.ExposeConfiguration(cfg => new SchemaUpdate(cfg).Execute(true, true));
return factory.BuildSessionFactory();
}).InSingletonScope();
}