Singleton Pattern : Using a single dataSet in all over of application.
-
Hi i've wrote a sample database app, which use a single dataSet object in all over of the application (It's static). when a form open, the appropriate table of that dataset fill out and when form closing, that table clear. my question is that Is this best practise (where performance & overhead is important) ? u can download it via this link (http://rapidshare.com/files/227688281/Sample_Singleton_Pattern.rar.html[^]). plz run and test it and tell me your comments. Notes : 1. Plz first execute DbScript.sql to create 'Test' database and stored procedures 2. Use vs 2008 to work with sample project. 3. Change connection string in app.config. i'm waiting for your comments. Thanks
-
Hi i've wrote a sample database app, which use a single dataSet object in all over of the application (It's static). when a form open, the appropriate table of that dataset fill out and when form closing, that table clear. my question is that Is this best practise (where performance & overhead is important) ? u can download it via this link (http://rapidshare.com/files/227688281/Sample_Singleton_Pattern.rar.html[^]). plz run and test it and tell me your comments. Notes : 1. Plz first execute DbScript.sql to create 'Test' database and stored procedures 2. Use vs 2008 to work with sample project. 3. Change connection string in app.config. i'm waiting for your comments. Thanks
I'm not saying that your job is bad. but... I know better ways to do that, LinQ for example is an excelente way to work with data...
Preparing for 70-536
-
Hi i've wrote a sample database app, which use a single dataSet object in all over of the application (It's static). when a form open, the appropriate table of that dataset fill out and when form closing, that table clear. my question is that Is this best practise (where performance & overhead is important) ? u can download it via this link (http://rapidshare.com/files/227688281/Sample_Singleton_Pattern.rar.html[^]). plz run and test it and tell me your comments. Notes : 1. Plz first execute DbScript.sql to create 'Test' database and stored procedures 2. Use vs 2008 to work with sample project. 3. Change connection string in app.config. i'm waiting for your comments. Thanks
Yeah, probably not the worst way, but not the best either. I very rarely use a DataSet at all; I think they were only created to make demonstrating VS and book writing easy. They're like VB; they make doing easy things appear even easier, but quality results require more robust/lower-level techniques.
-
Yeah, probably not the worst way, but not the best either. I very rarely use a DataSet at all; I think they were only created to make demonstrating VS and book writing easy. They're like VB; they make doing easy things appear even easier, but quality results require more robust/lower-level techniques.
I actually needed a dataset recently, the proc was returning 2+ tables and was surprised my DAL had a method to support it. Datatables are the basic container in my DAL. I found performance dropped off dramatically when returning multiple tables from a single proc.
Never underestimate the power of human stupidity RAH
-
Hi i've wrote a sample database app, which use a single dataSet object in all over of the application (It's static). when a form open, the appropriate table of that dataset fill out and when form closing, that table clear. my question is that Is this best practise (where performance & overhead is important) ? u can download it via this link (http://rapidshare.com/files/227688281/Sample_Singleton_Pattern.rar.html[^]). plz run and test it and tell me your comments. Notes : 1. Plz first execute DbScript.sql to create 'Test' database and stored procedures 2. Use vs 2008 to work with sample project. 3. Change connection string in app.config. i'm waiting for your comments. Thanks
If performance and overhead is important, then don't use datasets (IMHO). Use a datareader to get the data and populate objects (and collections thereof) and return them. Do whatever is required to the objects, and have methods to re-populate the DB from teh new values. Depending on your requirements you may need to have your objects implement interfaces or inherit from base classes that 'know' if they are new (to the DB) or have been changed - but that's fairly simple in most cases (again, without knowing the requirements it's difficult to judge) The important thing, I think, is that if performance and overhead are important, writing it yourself will always be more efficient (OK, assuming you write it well) than a 'generic' solution.
___________________________________________ .\\axxx (That's an 'M')