The third screencast in the series talks about the Databind attribute in Monorail, which allows you to bind values to objects. I also extend the example to use ActiveRecord, and save the databound object to a database.
http://colinramsay.co.uk/screencasts/3/
It begins to highlight some of the more advanced uses of Monorail, and introduces the Castle implementation of the Active Record pattern. In the next screencast, I’ll be consolidating on the topics I’ve covered so far and address some of the real work problems which Monorail can easily solve.
One point of relevance: the use of ActiveRecord with Monorail is completely optional. I’ve used it here because I feel they integrate well, but if you’ve got another persistance framework which you’d prefer to use then that’s possible too!
Don’t forget to watch Getting Started with Monorail and Using Monorail, the first two screencasts in the series.
[...] Databinding and ActiveRecord - screencast [...]
Kevin Miller : Monorail ScreencastsColin,
Ive been watching your screencasts and following along on my own. Ive gotten to the point where im trying to save the user to the database. I am getting an exception (below) when user.Save(); line is executed. Do you have any idea what is causing this?
[AssertionFailure: null id in entry (don't flush the Session after an exception occurs)]
LorenNHibernate.Impl.SessionImpl.CheckId(Object obj, IEntityPersister persister, Object id) +146
NHibernate.Impl.SessionImpl.FlushEntity(Object obj, EntityEntry entry) +220
NHibernate.Impl.SessionImpl.FlushEntities() +310
NHibernate.Impl.SessionImpl.FlushEverything() +168
NHibernate.Impl.SessionImpl.Flush() +104
Castle.ActiveRecord.Framework.SessionFactoryHolder.ReleaseSession(ISession session) in c:\srcfile\CastleProject\trunk\ActiveRecord\Castle.ActiveRecord\Framework\SessionFactoryHolder.cs:214
Castle.ActiveRecord.ActiveRecordBase.InternalSave(Object instance, Boolean flush) in c:\srcfile\CastleProject\trunk\ActiveRecord\Castle.ActiveRecord\Framework\ActiveRecordBase.cs:540
Castle.ActiveRecord.ActiveRecordBase.Save(Object instance) in c:\srcfile\CastleProject\trunk\ActiveRecord\Castle.ActiveRecord\Framework\ActiveRecordBase.cs:482
Castle.ActiveRecord.ActiveRecordBase.Save() in c:\srcfile\CastleProject\trunk\ActiveRecord\Castle.ActiveRecord\Framework\ActiveRecordBase.cs:1232
Fantasy.Controllers.AccountController.Register(User user) in c:\Users\Loren\Documents\Visual Studio 2005\WebSites\Fantasy\Controllers\AccountController.cs:32
Loren: try debugging on user.Save and check that the values of user are what you’d expect…
Colin Ramsayjust finished watching this one.
andriyGreat stuff! Any chance of you going to make more?
Oh oh.. #4.. watching