Created
October 14, 2011 17:36
-
-
Save majimenezp/1287766 to your computer and use it in GitHub Desktop.
Test de nhibernate con consulta usando generics y linq
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using NHibernate; | |
using FluentNHibernate.Cfg; | |
using FluentNHibernate.Cfg.Db; | |
using FluentNHibernate.Automapping; | |
using NHibernate.Cfg; | |
using NHibernate.Tool.hbm2ddl; | |
using FluentNHibernate.Conventions; | |
using FluentNHibernate.Conventions.Instances; | |
using NHibernate.Linq; | |
using RFID.Entidades; | |
using NHibernate.Criterion; | |
using System.Data; | |
using System.Data.SqlClient; | |
namespace App.Dominio | |
{ | |
public class DominioApp | |
{ | |
public List<T> Todos<T>() | |
{ | |
List<T> lista; | |
using (var session = currentSession.OpenSession()) | |
{ | |
lista = session.Query<T>().ToList<T>(); | |
} | |
return lista; | |
} | |
public int Cantidad<T>() | |
{ | |
int cantidad; | |
using (var session = currentSession.OpenSession()) | |
{ | |
cantidad = session.Query<T>().Count(); | |
} | |
return cantidad; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment