1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
| public class BaseDao<TEntity,TId>: HibernateDaoSupport, IBaseDao<TEntity,TId>
{
#region IGenericDao<TEntity,TId> Members
public void GetConfiguration()
{
}
public IList<TEntity> GetAll()
{
return HibernateTemplate.LoadAll<TEntity>();
}
public void Save(TEntity obj)
{
HibernateTemplate.Save(obj);
}
public void Update(TEntity obj)
{
HibernateTemplate.Update(obj);
}
public void Delete(TEntity obj)
{
HibernateTemplate.Delete(obj);
}
public TEntity GetById(TId Id)
{
return HibernateTemplate.Get<TEntity>(Id);
}
public IList<TEntity> GetList(DetachedQuery dq)
{
return dq.GetExecutableQuery(Session).List<TEntity>();
}
public IList<TType> GetList<TType>(DetachedQuery dq)
{
return dq.GetExecutableQuery(Session).List<TType>();
}
public IList<TEntity> GetList(DetachedNamedQuery dnq)
{
return dnq.GetExecutableQuery(Session).List<TEntity>();
}
public IList<TType> GetList<TType>(DetachedNamedQuery dnq)
{
return dnq.GetExecutableQuery(Session).List<TType>();
}
public IList<TEntity> GetList(DetachedCriteria detachedCriteria)
{
return detachedCriteria.GetExecutableCriteria(Session).List<TEntity>();
}
public IList<TType> GetList<TType>(DetachedCriteria detachedCriteria)
{
return detachedCriteria.GetExecutableCriteria(Session).List<TType>();
}
#endregion
} |
Partager