How to map Tsql User Defined Function using Fluent NHibernate? I have found a solution which works with hbm.
http://ayende.com/blog/1720/using-sql-functions-in-nhibernate
But I am using ClassMaps.
How to map Tsql User Defined Function using Fluent NHibernate? I have found a solution which works with hbm.
http://ayende.com/blog/1720/using-sql-functions-in-nhibernate
But I am using ClassMaps.
I believe that <sql-query> is not yet implemented in FluentNHibernate. There's an open issue on GitHub.
However, you can mix both fluent mappings and .hbm mappings using FluentNHibernate configuration. Here's an example for that: http://www.dotnetguy.co.uk/post/2009/11/01/stored-procedures-with-fluent-nhibernate/
Something like this:
Fluently.Configure()
.Database(MsSqlConfiguration.MsSql2008.ConnectionString(c => c.Is("...")))
.Mappings(m => m.FluentMappings.AddFromAssemblyOf<SessionFactory>())
.Mappings(m => m.HbmMappings.AddFromAssemblyOf<SessionFactory>())
.BuildSessionFactory();