为什么与LINQ的流利NHibernate返回一个空列表(与Oracle数据库)? [英] Why is Fluent NHibernate with LINQ returning an empty list (with Oracle database)?

查看:128
本文介绍了为什么与LINQ的流利NHibernate返回一个空列表(与Oracle数据库)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Fluent NHibernate(NH3构建 - #694)和LINQ连接到Oracle 11数据库。但是,我似乎无法从数据库中获取任何数据。连接似乎正在工作,因为,如果我更改我的登录信息,它会引发错误。

我使用下面的代码:

  //安装程序。 

OracleClientConfiguration oracleClientConfiguration =
OracleClientConfiguration.Oracle10
.ShowSql()
.ConnectionString(的connectionString);

_sessionFactory =
Fluently.Configure()
.Database(oracleClientConfiguration)
.Mappings(M => m.FluentMappings
.AddFromAssemblyOf<订阅> ;())
.BuildSessionFactory();

//查询。

using(ISession session = _sessionFactory.OpenSession())
{
IEnumerable< Category> categories = session.Query< Category>()。ToList(); //返回空列表

//等等...
}

我有一个分类表的地图,但不管我放在那里,我仍然得到一个空的列表。此外,即使我使用ShowSql(),我没有看到VS(2010)窗口中的任何NHibernate输出。



我使用TestDriven.NET(3 .x)来运行代码。没有错误抛出,返回的集合上的Assert.NotEmpty(xUnit)失败(显然)。

我卡住了,代码正在运行,只是没有返回我不能得到任何诊断信息。我甚至试图让NHibernate写入log4net(TraceAppender),但是,再次,没有什么。

我很感激任何指针 - 即使这是一种获取的东西告诉我什么它试图做的。


解决方案

原来,在映射中使用的一个类被标有 内部 。


I'm using Fluent NHibernate (the NH3 build - #694) and LINQ to connect to an Oracle 11 database. However, I don't seem to be able to get any data from the database. The connection seems to be working, as, if I change my login info, it throws an error.

I'm using the following code:

// Setup.

OracleClientConfiguration oracleClientConfiguration = 
    OracleClientConfiguration.Oracle10
        .ShowSql()
        .ConnectionString(connectionString);

_sessionFactory =
    Fluently.Configure()
        .Database(oracleClientConfiguration)
        .Mappings(m => m.FluentMappings
            .AddFromAssemblyOf<Feed>())
        .BuildSessionFactory();

// Query.

using (ISession session = _sessionFactory.OpenSession())
{
    IEnumerable<Category> categories = session.Query<Category>().ToList(); // Returns empty list.

    // And so on...
}

I have a map for the Category table, but, no matter what I put in there, I still get an empty list. Also, even though I use ShowSql(), I'm not seeing any NHibernate output in the VS (2010) window.

I'm using TestDriven.NET (3.x) to run the code. No errors are thrown and the Assert.NotEmpty (xUnit) on the returned collection fails (obviously).

I'm stuck, as the code is running and just returning nothing and I can't get any diagnostic info. I even tried getting NHibernate to write to log4net (TraceAppender), but, again, nothing.

I'd appreciate any pointers - even if it's a way of getting the thing to tell me what it's trying to do.

解决方案

Turns out that one of the classes used in the mapping was marked "internal".

这篇关于为什么与LINQ的流利NHibernate返回一个空列表(与Oracle数据库)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆