I am trying to write my domain model as non-violent as possible . The only thing I am doing right now is to note every property and method virtual, since NHibernate requires that for lazy loading.
In my model assembly I define some repository interfaces:
public interface IRepository<TEntity> where TEntity : EntityBase {
TEntity Get(int id);
}
public interface IProductRepository : IRepository<Product> { ... }
Then I have a data assembly . This one will refer to NHibernate, he knows about its existence. This is the assembly that implements these repository interfaces:
public abstract class Repository<TEntity> : IRepository<TEntity> {
public TEntity Get(ind id) { ... }
}
public class ProductRepository : Repository<Product>, IProductRepository {
}
etc.
. BeginTransaction IRepository. , NHibernate.ITransaction, , NHibernate .
?
void BeginTransaction(), a void Commit() a void RollBack() , ITransaction ?
ITransaction, , ?
!