This project is read-only.

How do I get started using MicroDal in my web project?

When the class library (microdal.dll) is downloaded and included in the project, you only have to configure the database connection, and you are ready to go. Remember to qualify the connection, with a provider name. Eg.:

    <add name="MyDb" connectionString="data source=|DataDirectory|\cmsdata.s3db;New=true" providerName="System.Data.SQLite"/>

Now You can use MicroDal with manual session management. That means; you specify the name of the connection every time you use a session:

using (var ses = new DataSession("MyDb")){
    var idx = ses.FetchScalar<int>("SELECT @@IDENTITY");

Do you want to let MicroDal manage database connection, and thus optimize the use of the connection, simply register the the DataSessionHttpModul in the web.config:
  <add name="MicroDalSession" type="MicroDal.Context.DataSessionHttpModule, MicroDal"/>

So are all the functionality of a static property on the Data Session object - Current. You can then simply use the session when you want it - MicroDal closes and cleans up automatically.

Data Binding is now a simple case:

list1.DataSource = DataSession.Current
        "SELECT * FROM Address WHERE id=@1",

To use this approach, You need to ensure that there is column-names that correspond to properties of the Address object. If not, You must qualify its SQL search with alias matching the attribute names. The Object should have a constructor with no parameters to be used as a DTO.

Last edited Sep 12, 2012 at 8:15 AM by TheIMan, version 6