add join\filter to a query

Posts   
1  /  2
 
    
mma02
User
Posts: 26
Joined: 04-Aug-2009
# Posted on: 18-Nov-2009 09:34:46   

have to mention you are modifying the query yourself.

No problem here.

ok, but isn't that simply a problem of the query

the architectural desision says - application code shouldent have to do it, it should be done behind under the covers.

I did suplly a real example, and i specified HOW this a certain record got the organozation unit's id - the value is specified by the user, a certain user can create records for multiple organization units and that way we cant determine the urganization unit simply by recognizing the user that has created the record.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39862
Joined: 17-Aug-2003
# Posted on: 18-Nov-2009 11:34:26   

mma02 wrote:

ok, but isn't that simply a problem of the query

the architectural desision says - application code shouldent have to do it, it should be done behind under the covers.

You can't view all threads on this forum system, some are hidden for you. This is a BL decision and the filters necessary are appended by the code. Not transparently, but when needed. This would make it much easier for you, e.g. add a method which appends the filters for you to the Linq query and fetches the data.

I did suplly a real example, and i specified HOW this a certain record got the organozation unit's id - the value is specified by the user, a certain user can create records for multiple organization units and that way we cant determine the urganization unit simply by recognizing the user that has created the record.

If I ask for a set of data, could you please help me get that data? I can't help you if you keep on describing your security system with descriptions which get more precise per post. I don't have your database in front of me, nor your code, all I have is your descriptions here, so please help us help you. For example, do records contain a user id? or an organisational unit id? If it's a userid, do you have millions of users? Or 100? If you have 100, you thus have 100 or less organisations.

Say you have 10 organisations and each have 10 users. You can then append a range filter on those 10 users and you don't have to join. Makes it easier already. But I'm guessing here as you didn't provide exact data so we can all see what you mean and know exactly what we're talking about. That's what makes it for us cumbersome to help you as well. Perhaps the range filter is ridiculous because you have 50000 users, I have no idea. Also, you said you need this on all tables. However that sounds like you are storing databases for multiple organisations in ONE catalog/schema.

Why not create one schema for each organisation? With adapter you can switch schema on the fly. Because of this filtering which should be automatic, you will never be able to read data from multiple organisations anyway. This of course doesn't work if organisations can be created on the fly and you'll have thousands.

But that again sounds like the same problem as every role-based security using system has: some content is not readable by all people and has to be filtered. You always have shared data readable by all and limited data readable by a selected group. With automatic filtering, you can never have shared data (e.g. admin data to manage the system). With role-based security, every query gets the proper filter appended by the BL, as it's a BL mechanism: change the security and you can do that, extend the filtering, lower the filtering, that's all part of the system on top of the data.

But enough about this, you decided to go for query manipulation, I just wanted to give our point of view on this wink

Frans Bouma | Lead developer LLBLGen Pro
1  /  2