Tips and Tricks in a world of Mix

Posts tagged ‘connecting fnh to sp’

Problem Using Stored Procedure with Fluent Nhibernate

    1. Gave the mapping file the extension .hbm.xml
    2. Set the build action to ‘Embedded Resource’
    3. Set the copy-to-output to ‘Copy Always’
    4. Created the Hbm for SP:

<?xml version=1.0encoding=utf-8?>
hibernate-mapping xmlns=urn:nhibernate-mapping-2.2assembly=Infranamespace=Infra.Entities>
<sql-query name=GETMYDATA>
return class=Kav>
return-property column=Kav.MAKAT8name=MAKAT8/>
return-property column=Kav.DESCRIPTIONname=DESCRIPTION/>


5. Created the Entity class :

using System;

namespace Infra.Entities
public class Kav : Entity
public virtual string Makat8 { get; set; }
public virtual string Description { get; set; }

6. Created the Mapping class for the entity:

namespace Infra.Entities.Mapping
public class KavMapping : EntityClassMap<Kav>
public KavMapping()
Id(x => x.Makat8).Column(“MAKAT8”).Length(10);
Map(x => x.Description).Column(“Description”).Length(50);


7. Added the mapping to the FNH configuration (the entities and hbm in the same assembly) :

.Mappings(m =>
} )

I’ve read Ayende’s post on connecting to SP , but I’m failing to connect.

How should I map the Kav so that I could get the list of entities from SP ?

Tag Cloud

%d bloggers like this: