I am using Nhibernate with fluent. Now I want to call some Stored procedure and use named Queries. I created some xml:
<?xml version="1.0" encoding="utf-8"?>
<hibernate-mapping>
<sql-query name="CleanAppendicesHierarchies">
exec intf_CleanUpAppendixHierarchy
</sql-query>
</hibernate-mapping>
FluentConfiguration cfg =
Fluently.Configure().Database(MsSqlConfiguration.MsSql2005.ConnectionString(
c => c.Is(dbConnectionString)).ShowSql())
.Mappings(m => m.FluentMappings.AddFromAssembly(mappingAssembly))
.Mappings(m => m.HbmMappings.AddFromAssembly(mappingAssembly));
Now I got always the Exception:(most inner exception) {"hibernate-mapping xmlns='' was not expected."} {"There is an error in XML document (1, 2)."}
I fiddled around but if I remove hibernate-mapping then it complains about the sql-query tag.
What is wrong in my approach? I googled already found exam开发者_JS百科ples but of course with out Fluent....
Any hint is appreciated
Strange, I got it working with that:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
assembly="FactsheetsDataLayer"
namespace="FactsheetsDataLayer">
<sql-query name="CleanAppendicesHierarchies">
exec intf_CleanUpAppendixHierarchy
</sql-query>
</hibernate-mapping>
Then I named the XMl like: POCOClassName.hbm.xml
I do not know what helped but now it worked....
精彩评论