ASP.NET 2.0 C# DAL Multiple Variable Parameters -
I am preparing a web app for querying a large database table based on the selection of users of the criteria. In some cases they can know and enter the primary key, second time they want to see the records of the status 'ABC' created in the last 7 days, or records created by 'Fred Smith', where the word 'proposal' 'Is included. The issue is, there can easily be 10 - 20 different variables which they can specify, depending on what they are looking at.
It is quite easy for me to create SQL statement and dynamically apply parameters. Code behind the webpage (aspx.cs) This approach works well.
However, I'm reading on using a BLL & amp; Team (or even that I was just a pulse), but all the examples which have been despised parameters getCategories (like) or a single parameter such as GetProductByID (int productId)
I On the advice, it is on BPL / DAL with 20 variable parameters (for example) with many parameters (this is useful, but it is extremely delicate, especially if a new selection parameter has been added ).
Other ideas about which I have thought about
a) Create a single string parameter, which can be decoded in the law, such as:
string parameters = "datefilled = made; 2011 -03-01; condition = ABC "
BLLGetrecords (PARAM);
(Workforce, but terrible and prone to mistakes)
b) Use a straight or class as parameter, for example Params Status = "ABC";
Parameters.SavedBusur = 23;
(Is there a problem with DAL having access to this structure / class? I have read that DAL should not share any context with those sections which are called it?
Thanks for any suggestions on how you will implement this scenario.
In my projects I am stable I am creating the class As you see in DB, we have only one stored procedure with many different arguments DataManager that the data received, such as
public static IList & lt all required cars ActionHistoryData & gt; GetActionHistoryList (DATETIME STARTDATE DATETIME, ENDDATE, bool postprocessed) {Return GlobalComponents.DataManagerImpl.GetActionHistoryList (Zero, Null, Null, Null, Null, Null, STARTDATE, ENDDATE, False, Postprocessed, Faucet );} public static ActionHistoryData GetActionHistory (int id) {IList & LT; ActionHistoryData & gt; actionHistoryList = GlobalComponents.DataManagerImpl.GetActionHistoryList (ID, nULL, nULL, nULL, nULL, nULL, nULL, nULL, nULL, nULL, nULL, Zero); CQUtti Verify (! Collection. HistoryList), "[id = 'no action history with {0}' 'id'); CQGUtils.Verify (Akshnlitilistkkount == 1," more than one action returned to history. " ); Return History Historical List [0];}
GetActionHistoryList (
ActionHistory for table data). Dynamic SQLSc in the stored process.
`
Comments
Post a Comment