无法从
NHibernate.Driver.SqlServerCeDriver, NHibernate, Version=3.3.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4
创建驱动程序。使用流利的NHibernate SQL Server CE无法创建驱动程序
内exeption: 在装配System.Data.SqlServerCe的IDbCommand和执行的IDbConnection找不到。确保程序集System.Data.SqlServerCe位于应用程序目录或全局程序集缓存中。如果程序集位于GAC中,请使用应用程序配置文件中的元素指定程序集的全名。
这是我在尝试使用流利的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);
}
谢谢!这很重要!
我发现它打破了buildsessionfactory ... helpppp !!!!
是的,我可以肯定它可能是别的东西吗?也许东西与组件文件? – user1430430
我加这个exeption的内部豁免..也许它可以帮助 – user1430430
没关系,我发现它!!!! thanku非常愉快的一天! – user1430430