use*_*430 1 nhibernate fluent sql-server-ce
无法从 中创建驱动程序
NHibernate.Driver.SqlServerCeDriver, NHibernate, Version=3.3.0.4000, Culture=neutral, 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);
}
Run Code Online (Sandbox Code Playgroud)
谢谢!这很重要!
我发现它在 buildsessionfactory 中崩溃了...helpppp!!!!
如果您是从 .net core 访问的,并且收到错误消息
找不到程序集 System.Data.SqlServerCe 中的 IDbCommand 和 IDbConnection 实现。确保程序集 System.Data.SqlServerCe 位于应用程序目录或全局程序集缓存中。如果程序集在 GAC 中,请使用应用程序配置文件中的元素来指定程序集的全名。
假设您已经通过 NuGet 安装了 NHibernate,那么您需要确保安装了适当的 Sql 包。那里有几个非官方的System.Data.SqlServerCe
。就我而言,我需要System.Data.SqlClient
归档时间: |
|
查看次数: |
3676 次 |
最近记录: |