ADAL 1.0.6

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?

Leave a Reply

Your email address will not be published. Required fields are marked *