In my case, I want to retrieve one value only from a stored procedure and do I really need to use a class that shall contain a single value only?
How should I create inside of the .hbm.xml and how should I write in c# code when I don't want to use a class?
The code below is used when you need to have class that shall contain a lot of data.
Keyword: Nhibernate, XML, Csharp
sp_retrieveAllProductList.hbm.xml
exec sp_retrieveAllProductList :Produkt_kategori
public IList
{
return _session.GetNamedQuery("sp_retrieveAllProductList2")
.SetResultTransformer(Transformers.AliasToBean(typeof(Product4)))
.List
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace data_layer
{
public class Product4
{
public virtual string PK_produkt { get; set; }
public virtual string Produkt { get; set; }
public virtual string Produkt_kostnad { get; set; }
public virtual string btn_namn { get; set; }
}
}
Replies
Know the answer? Post it — somebody with the same question will find it here.