Hi all,

Options:  Download now, or read and then download at the bottom.

 ADAL 1.0.6 has been released.  There is a new feature in this release for anyone doing their own extensions, PopulateFromReader!  Basically this method that is available on every Item that ADAL creates will accept a SQLDataReader and auto populate the properties of the object for you.  Yes, that’s right, no more:

 IIF(MyReader(“ColumnName”) Is DBNull.Value, Nothing, MyReader(“ColumnName”))

Now isn’t that nifty?  This allows you to create an extension in a Partial class without too much worry.  Just make sure that the reader has all the fields the object will need or you’ll see a yellow screen of death.

 The code that ADAL creates for a Select Now looks something like:

Public Function [Select](ByVal ColumnName As String) As Classes.TableItem
Dim retObject As New Classes.TableItemTry

Dim MyReader As SqlDataReader
MyCommand.CommandText = “ADAL_usp_TableItem_Select”

With MyCommand.Parameters
.Clear()
.Add(“@ColumnName”, SqlDbType.VARCHAR, 2).value = ColumnName
End With

SqlConnection1.Open()
MyReader = MyCommand.ExecuteReader(CommandBehavior.CloseConnection)retObject.PopulateFromReader(MyReader)
MyReader.Close()Catch ex As Exception
Throw
Finally

If SqlConnection1.State = ConnectionState.Open Then SqlConnection1.Close()
End Try

Return retObject
End Function

The new PopulateFromReader is in bold. 

There’s also a bug fix in this version.  When ADAL was creating code to check for the length of strings during Property Sets if failed to check if the value was not nothing, and ended up causing an exception if it was (it was just using If MyString.Length > 0 Then).

Maybe you want to head on over to SourceForge and give it a Download?

An official release of ADAL, version 1.0.5 is available form the ADAL SourceForge.net download page (http://sourceforge.net/projects/adal). There’s a couple new features in this version, most notably:

  • Uses an .msi installer
  • Has “File Save” and “File Open” commands that write the current configuration to a custom XML file so you can reload the settings you had last.

There’s also a quick bug fix. When a table is all primary keys, ADAL used to generate a “GRANT EXECUTE ON” for the UPDATE stored procedure, even though it didn’t generate the CREATE statement for the update, so it generated a SQL error when you ran the SQL script. This has been fixed.

Plans for the future are:

  • Templating – Develop a templating system so that users can create their own VB code templates that ADAL should generate around. this will be quite hard to get right, so I wouldn’t expect it too soon.
  • Use embedded (but still paramaterized) SQL. This would remove the need to create the stored procedures, which can be nice to keep the use of ADAL fairly simple.
  • Take a look at Paul Kimmel’s Ideas about a Data Acces Layer and see how much of that can be used in ADAL (http://www.developer.com/net/vb/article.php/3650241)

I decided to make ADAL Open Source.   “Why not?” I figured.  I never planned on charging for it, and now that it’s open source I get to host it at SourceForge and get the use of their Subversion Source Control servers.  So anyway, I haven’t done an official release over at SourceForge yet, but at least you can get the code from Subversion and compile it yourself if you want the most recent version.  The SourceForge URL is: http://sourceforge.net/projects/adal

Don’t be afraid to use the SourceSorge forum and feature request system either…

 Have fun!

I used to have the Flickr Badge on the right hand sidebar, but it seemed to be slowing down the blog (I’d frequently see my browser “Waiting for www.flickr.com…”). It’s gone now, we’ll see if performance improves.

  • Removed VB syntax highlighting until we develop our own.
  • Identifies tables with auto-increment fields and alters the insert to not attempt to insert into that field (would generate a SQL error). The DAL class also sets the ID property of the item passed in to the new auto-incremented value.
  • UPDATE statements now update every field (even the primary keys). This is weird but was needed in order to satisfy cases where every column in the table is part of the primary key (ADAL used to generate invalid code in this case). I suppose this makes the execution of the update statement a little slower, but in the interest of reliability I’m willing to make the sacrifice.
  • Interprets DECIMAL datatype correctly

Now With Options!

  • Options menu item opens options form!
  • Change root namespace (defaults to ADAL)
  • Put the item classes and DAL classes in the same or separate namespaces (Defaults to “Classes” and “DAL”)
  • Customizable stored procedure prefix. This allows you to easily identify which stored procedures belong to the ADAL objects (in case you need to delete either the ADAL or your own it’ll help prevent what I did when I deleted a few custom stored procedures because they all looked the same).
  • Option to generate “GRANT EXECUTE” statements on the stored procedures created. No more “Execute permission denied” errors!
  • Option to include validation code on varchar property gets and sets for length. ADAL throws an exception if you enable this and you try to set an items property with a value that’s too long.

Still With Problems

  • There are still data types (like tinyint that ADAL doesn’t know what to do with). I’ll get to those eventually….

Download: ADAL Version 0.3 

Spamalot
I just downloaded and installed Akismet so hopefully I won’t have to deal with spam any more. We’ll see.

CMS Search
I also checked out some CMS packages yesterday and think the one that looks the best so far is CMS Made Simple It has a nice simple interface that allows me to add new categories, and pages under the categories. It offers links between pages, but does not keep track of what pages are linked to what. So it allows me to delete a page that is being linked to from another, that’s the only part I don’t like so far…

For a free demo of CMS Made Simple, check out http://opensourcecms.com/index.php?option=content&task=view&id=452

I’ll keep looking on http://opensourcecms.com/ for a CMS, but so far this one’s out front.

Here’s a neat little site that shows short video clips of Linux distrobutions…if you like that shitty Linux OS: http://linclips.crocusplains.com/

I forgot, there’s more stuff I need to do:

  1. Get a CVS source control solution that works with Visual Studio I believe this will consist of either a local cvs server, or sourceforge projects (and their cvs server). Hopefully I’ll get something like http://www.jalindi.com/igloo/ to work so I can connect Visual Studio to cvs and feel like I’m working with VSS.
  2. Finish varnishing my boat’s wood pieces. Also maybe fill the inner cabin with epoxy / filler to make it look nice inside, then I can paint it too.
  3. Change the oil in my truck.
  4. Delete this crappy linux OS.

I went bowling last night for the first time in…15 years?…my first game really sucked, I even had a couple gutter balls, but my second game was really good.  I had a few strikes, and one set of three strikes in a row.  Don’t tell anyone, but I’m pretty sure it was all luck.

I was starting to feel bad for the guys I was playing against until we played Halo later on in the night (around 1:00am).  They took their bowling frustrations out on me by completly kicking my ass.  Even with major handicaps on their part I was still only getting 8 kills out of 20 or whatever.

Programming

I’ve still got my homework list of programming chores for home.  With the nice weather it’s hard to motivate myself to do any programming at home, but the current list is:

  • Fix some of the problems with ADAL
  • Start work on MASS (Multi Author Story System)
  • Start work on Mage (.NET port of coppermine…sort of)
  • Start work on the AGI Application Gateway Interface
  • Maye install an open source CMS on the killfly root (http://www.killfly.com).
  • Delete this shitty Linux OS from my laptop and put XP back on.

ADAL v0.2

ADAL (Auto Data Access Layer) is a utility to generate the stored procedures and .NET classes needed to get up and running with a basic Data Access Layer.

License

Currently ADAL may be used for free by:

  • Students
  • Government Agencies
  • Educational Institutions

ADAL may not be used:

  • For Commercial purposes
  • By BFFs

v0.2 Means Not Ready for Production

The code that ADAL generates has been tested by me for a total of about 10 minutes.  As such I would not recommend running the tool against a production database.

ADAL does not encrypt its communication with the server, so unless you know the connection between you and the database server is reasonably secure, I wouldn’t use it for databases or data that you are really attached to.  You never know who’s listening to your wire looking for a database username and password to go flying by.

ADAL also has trouble with some datatypes right now, it can generate the Stored Procedures all right, but translating some SQL server datatypes to .NET data types gives it a headache.

Is it Really That Dangerous?

No, but i’m covering my ass.  ADAL itself only issues SELECT statements against the database, you can actually run ADAL with a very low-priviliage account.  It seems that as long as the account is a data-reader, it can get the information it needs.

Of course, ADAL does generate the CREATE statements to DELETE information from your tables.  So if you were careless, you could run one of these stored procedures and delete a row of data.  That’s about the worst that can happen.

How do I use it?

  • Download the ADAL .zip file below, and unzip the .exe inside.
  • Run the .exe.
  • Fill in the server, username, and password.
  • Click Connect
  • Select the database you want to generate a DAL for.
  • Check the tables you want to generate a DAL for
  • Click “Make A DAL!”.
  • Copy the SQL from the “SQL Output” tab into query Analyzer and run it.  Make sure to select the correct database first!
  • Copy the VB code from the “VB Output” tab into a new vb class file in your project.
  • Compile.
  • Have fun.  Enjoy not writing that crap by hand.

How Do I Download?

ADAL v.01

ADAL 0.2

Changes

ADAL 0.2

  • Added color highlighting to VB tab.  Only bug is that you have to click in the VB textbox and hit a key to trigger the color highlighting.
  • The account you use to connect with used to require that it have “master” as the default database.  This has been fixed.
  • There is a bug that was introduced as well, there is tome text (“test”)included at the end of each of the VB and SQL code windows.  You’ll have to delete this text before or after you use it.
© 2011 Killfly Blogs Suffusion theme by Sayontan Sinha