|
|
|
|
|
|
|
Page Views :
|
2356
|
|
Downloads :
|
0
|
|
Rating :
|
Rate it
|
|
Level :
|
Advanced
|
|
Why did I use Generic <T, K>?
This keeps the number of overloaded methods down to a minimum without using objects. Let me explain.
Method One, without Generic <T, K>:
- You would be to have an overloaded method for every type of CONNECTION and DATATYPE.
- Because of the different DATATYPES, you would need to rename the methods.
- I am sure that you can see that very soon, you have tons of methods and tons of code.
- For a developer user of the component this becomes complex.
- From a maintenance/enhancement point of view, this becomes tiring and can be costly.
Method Two, without Generic <T, K>:
- You have the same methods that I do, but both the CONNECTION and the DATATYPE are cast as objects.
- Well we all know that we can have compile issues and usability issues with objects, which is where Generics <T, K> are now part of Visual Studio 2005.
Technical Details of the component
- I have replaced the T with CONNECTION and the K with DATATYPE.
- When initializing the object, the first parameter, your CONNECTION, can be any of the following types:
- A Connection String
- A System.Data.SqlClient.SqlConnection
- A System.Data.OleDb.OleDbConnection
- A System.Data.Odbc.OdbcConnection
- An ADODB.Connection
- A Oracle.DataAccess.Client.OracleConnection
- To name a few...
- When Initializing the object, the second parameter, your DATATYPE, can be any of the following types:
- A System.String, here your data would be a disconnection XML formatted string, needed by those systems that can only handle strings.
- A System.Data.DataSet
- A System.Data.DataTable
- A System.Xml.XmlDocument
- There are four (4) exposed Public Methods, three (3) of them are overloaded:
- public DATATYPE Create(CONNECTION, string sql, string tableName)
- public DATATYPE Create(string provider, string sql)
- public DATATYPE Create(CONNECTION, string sql, string[] parameterList, string tableName, int Timeout)
- public void Update(CONNECTION, DATATYPE, string sql, string tableName)

Usage here is when you want to update/insert/etc data utilizing Typed DataSets
When the user updates the appropriate line/column
 After editing the data, the next method called (as highlighted below), will update the table utilizing Typed Dataset. This also works for inserts as well.

|
|
Comment Request!
Thank you for reading this post. Please post your feedback, question, or comments about this post
Here.
|
|
|
|
|
Login
to add your contents and source code to this article
|
|
|
|
|
|
|
|
|
|
|
|
art_scott
Senior Lead Architect/Developer utilizing .NET C# 2.0/3.0, ASP.NET, SQL Server 2005, Reporting Server, .NET 3.0 Workflow, and Web Services. methodologies are Extreme Programming on the Microsoft Enterprise Library utilizing Model View Presenter (MVP). I utilize Visio Architecture to create UML which is then used to update the Team Visual Studio 2005. As the architect and senior/lead developer ensuring design standards, I also train my team on MVP development (WinForms and WebForms), pattern development, C# 2.0/3.0 development and coding as a working in the coding trenches while taking the time to meet with clients on a regular basis and ensuring that our developers are not only being taken care of but excited about our technology and methodologies.
|
|
|
|
|
|
|
|
|
C# Consulting is founded in 2002 by the founders of C# Corner. Unlike a traditional
consulting company, our consultants are well-known experts in .NET and many of them
are MVPs, authors, and trainers. We specialize in Microsoft .NET development and
utilize Agile Development and Extreme Programming practices to provide fast pace
quick turnaround results. Our software development model is a mix of Agile Development,
traditional SDLC, and Waterfall models.
|
|
Click here to learn more about C# Consulting. |
|
|
|
|
|
|
|
Introducing MaxV - one click. infinite control. Hyper-V Hosting from MaximumASP.
Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon.
Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees.
As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
|
Dynamic PDF
ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications.
|
Nevron Chart for .NET 2010.1 Now Available
The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
|
ASP.NET 4 Hosting
Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites – Click Here!
|
|
|
|
|
|
|
|
|
|
|
|
|