开发者

Fluent NHibernate no data being returned

开发者 https://www.devze.com 2022-12-31 07:58 出处:网络
I have been successfully using NHibernate, but now I am trying to move to Fluent NHibernate.I have created all of my mapping files and set up my session manager to use a Fluent Configuration.I then ru

I have been successfully using NHibernate, but now I am trying to move to Fluent NHibernate. I have created all of my mapping files and set up my session manager to use a Fluent Configuration. I then run my a开发者_运维知识库pplication and it runs successfully, but no data is returned.

There are no errors or any indication that there is a problem, but nothing runs.

when using NHibernate, if I don't set my hbm xml files as an embedded resource, this same thing happens. This makes me wonder what I have to set my Map classes to. Right now, they are just set to Compile, and they are compiled into the dll, which I can see by disassembling it.

Does anyone have any thoughts as to what may be happening here?

Thanks

private ISessionFactory GetSessionFactory()
        {
            return Fluently.Configure()
                .Database(
                    IfxOdbcConfiguration
                        .Informix1000
                        .ConnectionString("Provider=Ifxoledbc.2;Password=mypass;Persist Security Info=True;User ID=myuser;Data Source=mysource")
                        .Dialect<InformixDialect1000>()
                        .ProxyFactoryFactory<ProxyFactoryFactory>()
                        .Driver<OleDbDriver>()
                        .ShowSql()
                    )
                    .Mappings(
                        x => x.FluentMappings.AddFromAssembly(System.Reflection.Assembly.GetExecutingAssembly())
                        //.ExportTo("C:\\mappings")
                    )

                .BuildSessionFactory();
        }


Does the executing assembly contain the fluent mapping classes? I would try:

.Mappings(x => x.FluentMappings.AddFromAssemblyOf<MappedType>())

Where MappedType is a class that has a fluent mapping.


They should just be set to compile, that's fine. Nothing special needed here. The problem is most likely in your fluent configuration rather than the mapping.

0

精彩评论

暂无评论...
验证码 换一张
取 消