CSLA 2.1 C# CodeSmith Templates

CSLA 2.1 C# CodeSmith Templates

Old forum URL: forums.lhotka.net/forums/t/2160.aspx


CaymanIslandsCarpediem posted on Wednesday, January 17, 2007

I'm just starting to look at the CSLA C# CodeSmith templates and have a question.  The first thing I generated was an EditableRoot.  I see a region with Delegation Methods and I'm not sure I understand what they are for.  I don't remember anythign like that in the book or in the sample app so am wondering if I should keep these or get rid of them.  Anyone have any insight as what these are for?

Cheers!

Tony

cds replied on Wednesday, January 17, 2007

Hi Tony

I took the CodeSmith templates and modified them heavily for my own purposes, but I do use the delegation methods.

The idea of these is for partial class generation - you have your generated code and sometimes you want to "hook into" the various data portal events - these delegate methods give you the opportunity to do that. So, in the user code you can hook up a delegate that will be called when the data portal method gets called.

For example, you could write some custom code to be executed after an object has been fetched from the DB, etc.

Craig

CaymanIslandsCarpediem replied on Wednesday, January 17, 2007

Thx, that makes sense!

Copyright (c) Marimer LLC