Unit of Work and EF
问题 I'm making an interface following the Unit of Work pattern. My interface looks like this: public interface IDataContext : IDisposable { void SaveChanges(); TSource Create<TSource>(TSource toCreate) where TSource : class; TSource Update<TSource>(TSource toUpdate) where TSource : class; bool Delete<TSource>(TSource toDelete) where TSource : class; IQueryable<TSource> Query<TSource>(); } So far so good. Now I implement it in my Data Layer, which uses EF4 as data provider. I came up with this