Advertisement
Guest User

Untitled

a guest
Feb 6th, 2012
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.66 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Diagnostics.Contracts;
  4. using Castle.Services.Transaction;
  5. using NHibernate;
  6.  
  7. namespace EnterpriseSample.Dao
  8. {
  9.     public abstract class GenericDao<T> : IGenericDao<T> where T:class, new()
  10.     {
  11.         private readonly Func<ISession> _session;
  12.  
  13.         public GenericDao(Func<ISession> session)
  14.         {
  15.             Contract.Requires(session != null);
  16.             this._session = session;
  17.         }
  18.  
  19.         [Transaction]
  20.         public IList<T> ListAll()
  21.         {
  22.             return _session().CreateCriteria(typeof(T)).List<T>();
  23.         }
  24.  
  25.         public IList<T> ListAll(int maxResults)
  26.         {
  27.             throw new NotImplementedException();
  28.         }
  29.  
  30.         public IList<T> FindAll(T exampleInstance, params string[] propertiesToExclude)
  31.         {
  32.             throw new NotImplementedException();
  33.         }
  34.  
  35.         public IList<T> FindAll(T exampleInstance, int maxResults, params string[] propertiesToExclude)
  36.         {
  37.             throw new NotImplementedException();
  38.         }
  39.  
  40.         public T FindOne(T exampleInstance, params string[] propertiesToExclude)
  41.         {
  42.             throw new NotImplementedException();
  43.         }
  44.  
  45.         public T Save(T entity)
  46.         {
  47.             throw new NotImplementedException();
  48.         }
  49.  
  50.         public T SaveOrUpdate(T entity)
  51.         {
  52.             throw new NotImplementedException();
  53.         }
  54.  
  55.         public void Delete(T entity)
  56.         {
  57.             throw new NotImplementedException();
  58.         }
  59.  
  60.         public T Update(T entity)
  61.         {
  62.             throw new NotImplementedException();
  63.         }
  64.     }
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement