Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/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 SQL Server CE无法创建驱动程序_Nhibernate_Sql Server Ce_Fluent - Fatal编程技术网

使用Fluent NHibernate SQL Server CE无法创建驱动程序

使用Fluent NHibernate SQL Server CE无法创建驱动程序,nhibernate,sql-server-ce,fluent,Nhibernate,Sql Server Ce,Fluent,无法从NHibernate.driver.SqlServerCeDriver创建驱动程序, NHibernate,版本=3.3.0.4000,文化=中性, PublicKeyToken=aa95f207798dfdb4 内部解释: 找不到程序集System.Data.SqlServerCe中的IDbCommand和IDbConnection实现。确保程序集System.Data.SqlServerCe位于应用程序目录或全局程序集缓存中。如果程序集位于GAC中,请使用应用程序配置文件中的元素指定程

无法从
NHibernate.driver.SqlServerCeDriver创建驱动程序,
NHibernate,版本=3.3.0.4000,文化=中性,
PublicKeyToken=aa95f207798dfdb4

内部解释: 找不到程序集System.Data.SqlServerCe中的IDbCommand和IDbConnection实现。确保程序集System.Data.SqlServerCe位于应用程序目录或全局程序集缓存中。如果程序集位于GAC中,请使用应用程序配置文件中的元素指定程序集的全名

这就是我在尝试使用fluent nHibernate时遇到的错误

我尝试了一些简单的例子,因为配置不适合本地数据库 使用此DLL

我的代码:

private static String ConnectionString = "Data Source = Database1.sdf";

public static ISessionFactory CreateSessionFactory()
{
        return Fluently.Configure()
            .Database(MsSqlCeConfiguration.Standard
            .ConnectionString(ConnectionString)
            .Driver<NHibernate.Driver.SqlServerCeDriver>()
            .Dialect<NHibernate.Dialect.MsSqlCeDialect>())
            .Mappings(m => m.FluentMappings.AddFromAssembly(System.Reflection.Assembly.GetExecutingAssembly()))
            .ExposeConfiguration(BuildSchema)
            .ExposeConfiguration(x => x.SetProperty("connection.release_mode", "on_close"))
            .BuildSessionFactory();
}

private static void BuildSchema(Configuration configuration)
{
        SchemaExport schemaExport = new SchemaExport(configuration);
        schemaExport.Execute(false, true, false);
}
private static String ConnectionString=“Data Source=Database1.sdf”;
公共静态ISessionFactory CreateSessionFactory()
{
流畅地返回。Configure()
.数据库(MSSQLSEConfiguration.Standard
.ConnectionString(ConnectionString)
.司机()
.方言()
.Mappings(m=>m.FluentMappings.AddFromAssembly(System.Reflection.Assembly.GetExecutionGassembly())
.ExposeConfiguration(构建架构)
.ExposeConfiguration(x=>x.SetProperty(“connection.release\u mode”、“on\u close”))
.BuildSessionFactory();
}
私有静态void BuildSchema(配置)
{
SchemaExport SchemaExport=新SchemaExport(配置);
schemaExport.Execute(false、true、false);
}
谢谢大家!!这很重要


我发现它在buildsessionfactory中被破坏…helpppp

您确定您的bin目录中有版本=3.3.0.4000的NHibernate吗?看起来您的bin目录中有一个不同的NHibernate构建

如果您确定它在那里,请检查您的参考资料是否正确:

您在项目中是否有以下参考:

"System.Data.SqlServerCe"
该目录位于以下目录中:

"C:\Program Files\Microsoft SQL Server Compact Edition\v3.5\Desktop\System.Data.SqlServerCe.dll"
确保您有:

"Copy Local" to true.

您确定bin目录中有版本=3.3.0.4000的NHibernate吗?看起来您的bin目录中有一个不同的NHibernate构建

如果您确定它在那里,请检查您的参考资料是否正确:

您的项目中是否有以下参考:

"System.Data.SqlServerCe"
该目录位于以下目录中:

"C:\Program Files\Microsoft SQL Server Compact Edition\v3.5\Desktop\System.Data.SqlServerCe.dll"
确保您有:

"Copy Local" to true.

如果您从.NETCore获取此信息,并且收到错误消息

程序集中的IDbConnection命令和IDbConnection实现 找不到System.Data.SqlServerCe。确保总成 System.Data.SqlServerCe位于应用程序目录或中 全局程序集缓存。如果程序集位于GAC中,请使用元素 在应用程序配置文件中,指定 大会


假设您已经通过NuGet安装了NHibernate,那么您需要确保安装了适当的Sql包。还有一些非官方的
System.Data.SqlServerCe
。在我的例子中,如果您是从.NETCore获取此信息并收到错误消息,我需要
System.Data.SqlClient

程序集中的IDbConnection命令和IDbConnection实现 找不到System.Data.SqlServerCe。确保总成 System.Data.SqlServerCe位于应用程序目录或中 全局程序集缓存。如果程序集位于GAC中,请使用元素 在应用程序配置文件中,指定 大会


假设您已经通过NuGet安装了NHibernate,那么您需要确保安装了适当的Sql包。还有一些非官方的
System.Data.SqlServerCe
。在我的例子中,我需要
System.Data.SqlClient

是的,我确定。它可能是其他的东西吗?可能是与程序集文件有关的东西吗?我添加了这个例外的内部例外。可能可以help@user1430430你应该提到帮助他人的解决方案。是的,我确定。它可能是其他东西吗?可能是与程序集文件有关的东西吗?我添加了这个解释的内在解释……也许它可以help@user1430430你应该提到帮助他人的解决方案。