|
-
Feb 9th, 2012, 02:12 PM
#1
Thread Starter
Junior Member
Linq to SQL?
I'm at a bit of a crossroads. I've gotten pretty comfortable with VB .Net and I do a lot of development work with VB .Net and SQL Server databases. Having been self-taught I can get things done "my way" pretty quickly and customers have been very happy with the results. But the more I learn, the more I realize there are different, maybe better, ways the same application can be built. Meaning the end result from the users' perspective may be no different, but from the developers looking at two sets of code could be worlds apart.
My general method up until now is I use SQLClient class along with CommandText to send SQL INSERT, UPDATE, DELETE statements dorectly to the SQL Server from the VB app. I have a function I use that will escape any special characters within any string variables. I put a lot of vb database functions in a module that all of my forms can use. When I need to pass data around I send/add arguments to functions using regular variables, etc... I log all of my SQL queries sent to the server to a log file for troubleshooting.
So far this has worked well. I know there are better ways to do this, Stored Procedures for example. But I just have not made that leap yet. I'm about to consider turning my world upside down!
I'm MOSTLY interested in creating custom Classes that represent the various objects in my database (Customers, Projects, Invoices, etc...). Then defining all of the properties each of these classes should have: Customer.ID, Customer.Name, Customer.Status, etc... and would like to "map" that Customer object to the database I'm interfacing with. I figure I can wrap all of the SQL commands into methods within each class, i.e.: myCustomer.Name = "Joe Smith"
Then I realize that is going to be a lot of work to setup all of the classes, along with their properties and methods. And then how do I log or troubleshoot the SQL that is actually happening, etc...?
Then I come across Linq to SQL. And there is a utillity called "SQLMetal.exe" which basically reads the schema of a database and does everything I'm talking about automatically? Is it really as simple as that? I mean I have never found the "easy way" to work very well. For example, I never use data designer UI (DataAdapters, DataTables, etc ) at design time. I am always binding my grids and controls at runtime because I find the simple bound-control mechanism isn't flexible enough for real world apps. So is that also the case with Linq to SQL and this SQLMetal thing?
Looking for some experienced advice and thoughts here. Thank you.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|