How would you fancy NOT having to write a DataAccess layer in your apps but instead to get the ASP.NET 2.0 engine to automatically serve the code to you straight from the Database Structure?
If you don't understand the problem, you need to spend a bit more time creating by hand (not allowed to cheat with CodeSmith or other...):
- Tables
- Views
- Stored Procedures
- .NET Data Access Code that calls everything and performs SELECT, INSERT, UPDATE and DELETE...
Then you will know what I mean especially if your DB has 250 tables, 150 Views and 640 Stored Procedures!!!
I was lucky enough to come across this article from Fritz Onion and I think it is absolutely awesome. Fritz you're a genius man!
http://pluralsight.com/blogs/fritz/archive/2004/09/06/2188.aspx
Using that idea, I have been able to build a code generator that creates my DataAccess layer automatically from the Database, then in my code I only need to reference the relevant object and call methods against them like:
Dim objProfile as Profile
objProfile.ID = "1"
objProfile.Name = "Test Name"
objProfile.Update
How cool is that!!!
2 comments:
Hi Etienne,
I read your posts as listed below.
I am also having incredibly disastrous problem with my .xsd generated file when I change the database.
Do you have any further info on the topic at all.
And hopefully, more specifically, a setp-by-step procedure for vb.net?
Thanks in advance.
--------
Etienne Lambert
http://weblogs.asp.net/scottgu/archive/2006/01/15/Building-a-DAL-using-Strongly-Typed-TableAdapters-and-DataTables-in-VS-2005-and-ASP.NET-2.0.aspx#451730
http://weblogs.asp.net/scottgu/archive/2006/01/15/Building-a-DAL-using-Strongly-Typed-TableAdapters-and-DataTables-in-VS-2005-and-ASP.NET-2.0.aspx#451986
http://etiennel.blogspot.com/
http://pluralsight.com/blogs/fritz/archive/2004/09/06/2188.aspx
Hi there,
I have actually been able to use custom build providers to generate classes automatically, not .xsd files.
I will try and post some procedure on how I managed to accomplish this on my blog asap.
However, if you want to get your teeth into something quite meaty in the meantime, I have noticed on the web that a community of programmers had done exactly the same thing as me in a much better way, have a look at:
http://www.codeplex.com/actionpack
It's called subsonic and it's just great... does everything you want out of the box. The complete code base is available in C# and VB.NET. However, it's not writing xsd schemas I don't think, it is automatically generated classes.
Feel free to send me a message with your email if you wish to discuss any further.
Hope this helps,
Cheers!
Post a Comment