在我的 mvvm 项目中,有一个包含添加、更新、删除接口的接口。因此接口是数据访问层。其代码是:
public interface IAccountDataSource
{
bool Add(Account account);
bool Update(Account account);
bool Remove(Account account);
Account GetById(int id);
Account GetByName(string name);
IEnumerable<Account> GetByCategory(AccountCategory accountCategory);
IEnumerable<Account> GetBySearchTerm(string searchTerm);
IEnumerable<Account> GetAll();
event EventHandler<ObjectAddedEventArgs> AccountAdded;
event EventHandler<ObjectUpdatedEventArgs> AccountUpdated;
event EventHandler<ObjectRemovedEventArgs> AccountRemoved;
}
enter code here
任何人都可以说数据访问层是否意味着 ORM。数据访问层的优势是什么?