Skip to content

Instantly share code, notes, and snippets.

Created October 22, 2010 11:02
Show Gist options
  • Select an option

  • Save anonymous/640347 to your computer and use it in GitHub Desktop.

Select an option

Save anonymous/640347 to your computer and use it in GitHub Desktop.
GenericReportDataRepository<T> (NHibernate stored procs)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Castle.Facilities.NHibernateIntegration;
using System.Collections;
using NHibernate;
using NHibernate.Transform;
namespace Ideal.Reporting.Domain
{
public class GenericReportDataRepository<T> : Ideal.Web.ReportDataRepositoryBase<T>
{
public GenericReportDataRepository(ISessionManager sessionManager)
: base(sessionManager)
{
}
public IList<T> GetReportData<T>( Hashtable parameters, string spname, string appname)
{
string sql = string.Empty;
ISQLQuery sessSql = null;
sql = string.Format("@exec {0} ", spname);
sessSql = base._sessionManager.OpenSession("rttm").CreateSQLQuery(sql);
sessSql = AddScalarValues(sessSql, typeof(T));
return sessSql.SetResultTransformer(new AliasToBeanResultTransformer(typeof(T))).List<T>();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment