1, database table are set to delete id fields IS_DELETE, demands that Entityframework query data is IS_DELETE=False
2, for a list of data need to increase the default filter conditions (such as the where, in the like), in order to realize the data access control
May have the following methods (great god advice please add) :
1, set in the Context directly, but if the Context is generated, the scaffold or do the separation, this is not very flexible, high coupling,
2, use AutoMapper tools, such as filtering in transform, the problem is that I will find out all the data first, and a large quantity of data when there is a problem,
3, dependency injection, the problem is not to write, ha, ha, ha, use EntityFramework. Core 1.1 version
Welcome to the discussion
CodePudding user response:
The problem with dependency injection it doesn't matter, right?This is a complete set of solutions
CodePudding user response:
Upgrade, and 1.1, are now 2.2, there is a QueryFilterCodePudding user response:
Are 3.1 now have to change some configurationCodePudding user response:
Define an interface includes IS_DELETE properties, all entities to implement the interface, and then give a IQueryableCodePudding user response:
Implementation in the base class for the Service you want to query interface,