Hello, Gattaka, you wrote: G> Hello, gandjustas, you wrote: G>> Vykini NHibernate, take EF or linq2db, there there are no such problems. G> you will be , but we threw out before EF. There was a painful passage on NH... At EF too a heap of lacks, for example it is not allowed to receive to you pure domain objects. That is in classes of domain entities at you links to types from EF, and it is not correct. I, for example, should use freely domain essence on the client without dragging there ORM... And requests at EF it is simple some, NH in this plan it is better, though too . Here it is necessary to understand in the history: the compiler Command let out linq2sql to justify presence Expression Trees in C#. As guys in a compiler command very abrupt and from library it turned out very abrupt. Thus as well as all compiler - not expanded. Plans for long-term development linq2sql was not. Parallely dudes from a command sql server programmability took to nobody necessary, recomplicated object spaces and stretched on it linq. It turned out EF. He plainly was able nothing, demanded to be inherited from the classes and had strange enough dial-up of possibilities. To the version.NET 4.0 in linq2sql corrected pair of bugs, but more happened nothing, EF too refined (ef4) a little, made at least exterior include in entities, corrected a little linq the provider. But all the same ef4 was a shit. After that, in 2012, ef gave to a command asp.net. ASP.NET the command very abrupt, solves real problems, instead of invents . First of all they over crappy EF wrote code first and migrations, from this point on generally became possible to use EF (ef5). Then got rid from EDM and on a maximum threw out a heavy heritage object spaces (unfortunately not completely), it turned out quite worthy ORM (ef6). B the most important thing was laid out by all source codes in , appeared extensions. Now decided to throw out final old EF, left only code first api, for the provider used relinq (which by the way uses and NHibernate). It is called EF7 or EFCore. The heap of lacks about which you write is in EF4. And if to take necessary bases of everyone already now it is possible EFCore. G> do not trust. , here to you real business the scenario. There is a computer network in which there are network points and users. They have communications among themselves, it is we all we store in basis and we give the chance through our application . G> Tables User (Id, Name, Property), Network_Node (Id, Name, Property), User_User (User1Id, User2Id), Network_Node (Node1Id, Node2Id), UserOnNode (NodeId, UserId) G> In our basis of 70000 nodes on one user on a node (for simplicity). Users are connected all to all. For some (approximately half) nodes sign Prorepry has been put down - now it is necessary to add for such nodes on which there are the bound users. Especially count the size of table User_User, it is the pleasant moment And what task it is necessary to solve? G>>>> the SQL text which more laconic also is better read has no relation to high performance. G>>> well it there was a second argument: 1. Productivity, 2. and expressiveness. All the same SQL very powerful he allows you to request that is necessary for you, instead of as the data. G>> Ok, write the request satisfying following conditions: G>> 1) If the user the administrator it to show all records G>> 2) If the user not the administrator G>> - to show it records where the user = author G>> - or the author of record is included into group of friends of current user G>> - and records should not be hidden G>> 3) Records have to be filtered on a category which the user (id selected categories - a query parameter, can be empty) G>> Thus request should be as much as possible laconic and fast. G> I consider - perfectly, practically in natural language G> G> select r.id, r.name G> from rows as r G> where r. IsHidden = false and G> (exists (select * from Administrators a where a. User = r. User) or G> exist (select * from UserFriends uf where uf. User = r. User and r. Friend = @currentUser)) G> 1) the Filter on a category forgot 2) the Filter on the author of a post forgot 3) the Filter on managers incorrect, should be the current user the administrator, instead of the author the Most important thing even in such type basis does not construct the optimal plan and request will be fulfilled badly. The correct approach - to make 4 requests: 1) For the administrator without 2) For the administrator with the filter 3) For the normal user without the filter 4) For the normal user with the filter These 4 request will work better any one which you will write. And with linq it leads only to two if in the logician of the program.