[英]What does Set<TEntity> do in IDbSet interface?
I read an article about UOW
in Entity Framework
, it has some code like this: 我读了一篇关于Entity Framework
UOW
的文章,其中包含如下代码:
public interface IUnitOfWork
{
IDbSet<TEntity> Set<TEntity>() where TEntity : class;
int SaveChanges();
}
i really dont understand what does Set<TEntity>()
do ? 我真的不明白Set<TEntity>()
做什么的?
All entities are stored in a context with different flags (for example DELETED, CHANGED) in front of your database. 所有实体都存储在数据库前面的上下文中,该上下文带有不同的标志(例如DELETED,CHANGED)。 If SaveChanges will be called a synchronization with the database will be triggered. 如果将调用SaveChanges,则将触发与数据库的同步。 The Set contains all deleted and modified marked entities/database records inside a transaction. 该集合包含事务中所有已删除和已修改的标记实体/数据库记录。 If the transaction commit was successful the changes in all entities contained in the set will be visible; 如果事务提交成功,则该集中包含的所有实体的更改将可见。 if not a rollback will be started. 如果没有,将开始回滚。 It acts like a cache tracking all changes inside the target transaction. 它就像一个缓存,跟踪目标事务中的所有更改。 In this article a description of the UOW design pattern can be found ( http://www.codeproject.com/Articles/581487/Unit-of-Work-Design-Pattern ). 在本文中,可以找到有关UOW设计模式的描述( http://www.codeproject.com/Articles/581487/Unit-of-Work-Design-Pattern )。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.