Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/svn/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Fluent nhibernate 如何为一组实体自动映射数据库架构_Fluent Nhibernate - Fatal编程技术网

Fluent nhibernate 如何为一组实体自动映射数据库架构

Fluent nhibernate 如何为一组实体自动映射数据库架构,fluent-nhibernate,Fluent Nhibernate,我的数据库有多个模式,fluent nhibernate faq声明您可以为整个数据库或每个实体指定模式。我想为每个AutoPersistenceModel指定模式,可以这样做吗?明白了: public class SchemaConvention : IClassConvention { public void Apply(IClassInstance instance) { instance.Schema("schemaName"); } } Au

我的数据库有多个模式,fluent nhibernate faq声明您可以为整个数据库或每个实体指定模式。我想为每个AutoPersistenceModel指定模式,可以这样做吗?

明白了:

public class SchemaConvention : IClassConvention
{
    public void Apply(IClassInstance instance)
    {
        instance.Schema("schemaName");
    }
}


AutoPersistenceModel model = AutoMap.AssemblyOf<Whatever>();
model.Conventions.AddFromAssemblyOf<SchemaConvention>();
公共类模式惯例:IClassConvention
{
公共无效应用(IClassInstance实例)
{
Schema(“schemaName”);
}
}
AutoPersistenceModel model=AutoMap.AssemblyOf();
model.Conventions.AddFromAssemblyOf();