标签: fluent-nhibernate

错误:流畅的NHibernate映射,它引用了不同程序集中的映射

我的公司有多个站点,它们引用相同的DB和Core代码库.然后我们有一个管理数据的CMS.

在Core库中,我有一个Site类,它包含有关每个站点的一堆基本信息.这是我对它的流畅映射.

using Core.Model;  // Where Site class exists

namespace Core.Repository.NHibernate.Mappings
{
    public class SiteMapping : ClassMap<Site>
    {
        public SiteMapping()
        {
            Table("f_site");
            Id(x => x.Id, "f_site_id").GeneratedBy.Identity();
            Map(x => x.Domain, "domain_name").Not.Nullable();
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

作为CMS的一部分,我们会记录谁编辑了什么以及何时编辑.但我想只在CMS中引用Log类和映射,而不是在我的核心代码中,因为人们只能通过CMS编辑信息.

这是我当前流向Log类的流程映射,它引用了Site类.

using Core.Model; // where Site class exists
using Cms.Model; // where Log and CmsUser classes exists

namespace Cms.Repository.NHibernate.Mappings
{
    public class LogMapping : ClassMap<Log>
    {
        public LogMapping()
        {
            Table("f_log");
            Id(x => x.Id, "f_log_id").GeneratedBy.Identity();
            Map(x => x.Message, "message");
            Map(x => x.LogType, "d_log_type_id").CustomType<LogType>();
            Map(x => x.LogOperation, "d_log_operation_id").CustomType<LogOperation>(); …
Run Code Online (Sandbox Code Playgroud)

nhibernate nhibernate-mapping fluent-nhibernate fluent-nhibernate-mapping

0
推荐指数
1
解决办法
2329
查看次数

无法从NHibernate.Driver.SQLite20Driver,NHibernate,Version = 3.1.0.4000创建驱动程序

我有一个测试项目,我试图使用sql lite内存数据库测试我的nhibernate层.

我收到错误:

无法从NHibernate.Driver.SQLite20Driver,NHibernate,Version = 3.1.0.4000创建驱动程序,

private void CreateSessionFactory()
{
            _sessionFactory = Fluently
            .Configure()
            .Database(_dbType)
            .Mappings(m => m.FluentMappings
                .AddFromAssemblyOf<UserMap>())
            .ExposeConfiguration(cfg => _configuration = cfg)
            .BuildSessionFactory();
}
Run Code Online (Sandbox Code Playgroud)

我正在使用fluentnhibernate和nunit.

问题可能是什么?

更新

我从http://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki下载了x64(我在Windows 7 64位上) ,现在我收到了这个错误:

 Unable to load DLL 'SQLite.Interop.DLL': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
Run Code Online (Sandbox Code Playgroud)

如果我尝试在vs.net 2010中添加Interop.dll,它不会让我说它无法添加,请确保它是有效的等.

sqlite nhibernate fluent-nhibernate

0
推荐指数
1
解决办法
5592
查看次数

NHibernate SQLIte测试问题

下面是我尝试使用内存数据库进行单元测试时得到的错误消息.

SetUp:FluentNHibernate.Cfg.FluentConfigurationException:创建SessionFactory时使用了无效或不完整的配置.检查PotentialReasons集合,以及InnerException以获取更多详细信息.

----> NHibernate.HibernateException:无法从NHibernate.Driver.SQLite20Driver,NHibernate,Version = 3.3.1.4000,Culture = neutral,PublicKeyToken = aa95f207798dfdb4创建驱动程序.----> System.Reflection.TargetInvocationException:调用目标抛出了异常.----> System.ArgumentException:无法找到请求的.Net Framework数据提供程序.它可能没有安装.

错误发生在下面的代码行:

 private ISessionFactory CreateSessionFactory()
        {
            return Fluently.Configure()
                    .Database(SQLiteConfiguration.Standard.InMemory().ShowSql())
                    .Mappings(m => m.FluentMappings.AddFromAssemblyOf<Entity>())
                    .ExposeConfiguration(cfg => configuration = cfg)
                    .BuildSessionFactory();
        }
Run Code Online (Sandbox Code Playgroud)

我到处寻找,似乎无法找到解决这个问题的方法.我正在使用Fluent NHibernate,NUnit和VS 2012.

任何人都可以给我一些快速简单的建议,为什么我的单元测试在上面的代码返回行上失败了?

sqlite nhibernate unit-testing fluent-nhibernate

0
推荐指数
1
解决办法
1956
查看次数

流利的NHibernate现在准备好生产代码吗?

这个问题的主题不言而喻.我想知道Fluent NHibernate是否已准备好生产代码.我特别想知道我遇到的一些看似简单的问题,我还没有找到完全令人满意的解决方案(并且社区没有解决方案?)

为什么Fluent NHibernate无视我的惯例?

为什么Fluent NHibernate会忽略我对组件的唯一约束?

是的,我知道这个的老问题是超过一岁; 答案似乎有点 - 有点 - 也许.

流利的NHibernate现在可以投入生产吗?

fluent-nhibernate

-1
推荐指数
1
解决办法
233
查看次数