Before you read more of this blog, YACGT is word (inspired by WYSIWYG), invented in my mixed up head for Yet Another Code Generation Tool. It is not YACHT btw.
I'm having a course on C# and ASP.NET for begginers and advanced users (description is in slovene) whole winter semester. I decided to make something usefull this time for the students. Like a simple support portal for my course.
Why support? Well, they need practice, workshop materials, assigments, presentations in one place, not scaterded around different portals and platforms. One of the idea is also comments for each lecture type, we done, and general feedback on Solutions provided. Alot of features to code. I'm a little bit tired to do DAL (Data Access Layer) over and over again, because it is similiar and quite honestly, I allways trying to find another way to improve my life, especially because i dont have time, to play around with a new DAL class. I could write my own generic library, but one the end, i done some experiments and I was allways some special situation, so i stop trying. I had base implementation allmost ended, but dont have time to correctly finish it. Then testing must be performed, etc.
"Desperate times call for desperate measures" (by famousquotes.com)
I allways prefer to write my own code, because i allways know, which code and how it is executed. But, now i have a little time left to make a portal and fix all other problems, that accured on portals, i worked for another company ( this course i'm having for free for students ).
Friend of mine introduced me SubSonic, a code generation tool. I watch the video and it meet all my needs for DAL.
Database is small (few tables), portal is tiny (couple of pages and controls) and time budget is negative. :)
After installing it, and referenced to your app, all you must do, is to do a little magic in config file (web.config, if in ASP.NET, App.config, if in class library (or windows forms) or you can do a bat file call).
Then you have 2 choices:
1.) create DAL on the fly with abp file
2.) create class structure directly in your app or assembly
I picked the second one,cause I was anxious, how my classes will be generated.
So, here are my first overlook:
1.) it uses generics for base types.Expected, but cool :) They are all strong typed...
2.) it creates 2 class for one table
-- class with name of the table (and properties with field names)
-- class as Controller (basic options for query support: delete, select (fetch), insert, update)
3.) all this classes has ObjectDataSource support
4.) you have support for custom querying - Dynamic Query Tool ( I thought on writing my own, but this one is so cool )
5.) classes are marked as partial ( for your own implementation )
6.) it has also wrapper for stored procedures (calling a stored proc is so easy)
7.) it uses parameters for all sql statments
I really loved this tool. I never used ORM tools before, but this one change my way of thinking. Expect more posts on SubSonic project from me.
Use SubSonic page for future notice :) They have video tutorials prepared, api overview and there is also Sugar library, worth looking into.
Download avaible here, source avaible here (with instructions).