Last post Apr 16, 2009 06:01 PM by jayanthurs
Apr 10, 2009 05:50 PM|jayanthurs|LINK
For a large number of tables in my project (but not all) I need select to the records based on a certain flag. For e.g. STATE = 1 means the record is deleted, so I am not supposed to show records with STATE =1. However, this applies for some, but large number
I am thinking of writing a peice of code in Page_Init of each template. A pseudocode would be
table = GridDataSource.GetTable();
Any suggestion on this approach would be appreciated.
ASP.NET Dynamic Data
Apr 10, 2009 06:20 PM|ricka6|LINK
Are you using L2S or EF? If you're using L2S, I'd look at the new QueryExtender in the
ASP.NET Dynamic Data 4.0 Preview 3. QueryExtender will be supported in EF for Beta 2.
Apr 15, 2009 04:51 PM|jayanthurs|LINK
Thanks for responding.
I am using L2S. Due to some organization policy I cannot use preview. Is there a better solution than this?
Apr 15, 2009 04:57 PM|sjnaughton|LINK
Have you looked at
ASP.NET Dynamic Data Filtering
on codeplext by Josh Heyes? that works with L2S and have a look at my article here
Dynamic Data Filtering – Installation
Apr 15, 2009 05:09 PM|jayanthurs|LINK
Thanks Steve. I have been following most of your articles on csharpbits. It has helped me a lot.
Well I am using this solution for search, but it wont help me with the specific problem I have. I dont want to even load any items that has a Flag, say DELETED_RECORD = 1
Any suggestion would be helpful.
Apr 15, 2009 06:45 PM|ricka6|LINK
You can map the select to a stored proc with WHERE DELETED_RECORD <>1
Apr 16, 2009 10:30 AM|jayanthurs|LINK
Thats definitly an option. Since I have got like 30 tables in my project, I thought there could be an easy way of doing it. I was looking for some common approach to all the 30 tables. Also, I can keep the flag name same in all the tables.
Anything wrong in my approach listed above?(see first item).
Apr 16, 2009 02:49 PM|ricka6|LINK
Using a WHERE param is probably the best approach. Let us know how that works for you.
Apr 16, 2009 04:40 PM|jayanthurs|LINK
It works for me. I hope there is no performance implications on this approach.
Apr 16, 2009 04:50 PM|ricka6|LINK
If you can post all the changes you made with instructions - I'll run the SQL Profiler and gets some performance comparisons. I would guess as the number of marked for deletion rows increase, it will have a performance advantage. It's a simple query so
I don't think there will be any problems.
Apr 16, 2009 06:01 PM|jayanthurs|LINK
And, in the page template add this
protected void Page_Init(object sender,
//The below statement added for filtering deleted records.