Series of html ">PreviousIt was a long time ago. = during this period, the RTW of EF 4.1 has come out, and the Alpha of NH 3.2 has been 2... In fact, I am not lazy, and I have been using EF 4.1 at work. This is mainly because the last promised Update function is not fixed =
In short, this time's goal is
- Implement a complete IRepository (adding, adding, deleting, and modifying capabilities)
- Inheritance of domain objects
- Things
First, let's look at IRepository
My interfaces are as follows:
1: public interface IRepository<TEntity>
2: where TEntity : IEntity
3: {
4: IEnumerable<TEntity> FindAll();
5: TEntity FindById(int id);
6: void Add(TEntity entity);
7: void Delete(TEntity entity);
8: void Update(TEntity entity);
9: }
It should be regarded as the most basic warehousing interface.
The first few interfaces are well implemented. The DbSet object mentioned last time provides corresponding interfaces for direct calls. The code is similar to this.
1: protected DbSet<TEntity> DbSet