fluent nhibernate named-query without using hbm file for the map

后端 未结 1 1432
眼角桃花
眼角桃花 2021-02-15 18:14

I am needing to create a named-query, and use it with one of the maps, that i currently have defined as a fluent map.

is it possible to continue using the fluent map, a

1条回答
  •  -上瘾入骨i
    2021-02-15 18:31

    Maybe I'm misreading the question, but you don't have to switch to hbm mapping completely.

    You could continue to use fluent NHibernate to map classes and use hbm for named queries only. In your configuration, you'd then include the entities and the hbms.

    _sessionFactory = Fluently.Configure()
    .Mappings(m =>
    {
       m.FluentMappings.AddFromAssemblyOf();
       m.HbmMappings.AddFromAssemblyOf();
    })
    .BuildSessionFactory();
    

    In your namedQueries.hbm.xml you then only define named queries:

    
    
    
    
    
    
    

    0 讨论(0)
提交回复
热议问题