Mobile post test

Mobi test

CSLA and nHibernate

For awhile I’ve been trying to integrate Csla and nHibernate. Being new to nHibernate that is where my difficulties lay. However, recentlly I’ve come accross an excellent tutorial by Gabriel Schenker. You can find it here.

It was not too difficult to incorporate Csla into Gabriel’s excellent example.

Csla and nHibernatesolution

You can download the source here. Just create a new empty solution and add the three existing projects. The download includes a folder named sharedLibs, which has the referenced dlls for nHibernate and MySQL connector.

Not all Csla data portal methods are implemented only Fetch and Insert.

The Csla object was generated using Codesmith 2.6. You may want to convert the tests to nUnit tests. My example uses MySQL as the data store.

I don’t like my implementation 100%, but it works and is going to be my starting point for other projects. I would like to move the DTO into a separate project. But whenI try that I just can’t get nHibernate mapping to work. I get the dreaded “Unknown Entity” error and am not able to fix it.

Next up, a more complex Csla object, one with children then optimistic concurrency.

This is what the Fetch looks like

#region Data Access - Fetch
private void DataPortal_Fetch(SingleCriteria criteria)
        {
            IDALRepository repository = new DALRepository();
            var data = repository.GetById(criteria.Value);

            LoadProperty(IdProperty, data.Id);
            LoadProperty(NameProperty, data.Name);

            ValidationRules.CheckRules();
        }
        #endregion //Data Access - Fetch

This is what the Insert looks like

        #region Data Access - Insert
        protected override void DataPortal_Insert()
        {

            BudanArtLib.DAL.DTO.Item data = new BudanArtLib.DAL.DTO.Item();

            //data.Id = ReadProperty(IdProperty);
            data.Name = ReadProperty(NameProperty);

            IDALRepository repository = new DALRepository();
            repository.Add(data);

            LoadProperty(IdProperty, data.Id);

        }
        #endregion //Data Access - Insert

Winter

Winter

Winter in Muskoka
  • ApertureValue: f/6.1
  • Copyright: (C) Steve Budan 2009
  • ExposureTime: 1/130 sec
  • Flash: No Flash
  • FocalLength: 16.4 mm
  • ISOSpeedRatings: 80

Talavera

Talavera

  • ApertureValue: f/3.4
  • Copyright: (C) Steve Budan 2009
  • ExposureTime: 1/10 sec
  • Flash: No Flash
  • FocalLength: 14.7 mm
  • ISOSpeedRatings: 80

blue Flower

blue Flower

  • ApertureValue: f/4
  • Copyright: (C) Steve Budan 2009
  • DateTimedigitized: 2004:06:02 17:41:26
  • ExposureTime: 1/160 sec
  • Flash: No Flash
  • FocalLength: 300 mm
  • ISOSpeedRatings: 200

I heard the screen door slam

and a

Big yellow taxi

Took away my old man… Joni Mitchel ~1970

Tag

Mandy Budan Tag

Remember The Spirit of Radio in the 80s

CFNY 102.1

You probably already know but Rush’s The Spirit of Radio was inspired by CFNY.

Soooo if you liked 102.1 in the 80s check out The Mars Bar on Whitby’s 94.9 The Rock. He’s on Thursday and Friday nights. Go Dave! You still play the only  music worth listening to in Toronto.

Spring has sprung

Saw and heard the first Robin of the year yesterday morning. Saw one again this morning. Yeah! Spring. Heard a Blue Jay last week, but didn’t see it.

A cold Ontario day.

budanArt encased in ice!

budanArt on ice!

←Older