I'm starting a new, fair-sized project and hoping to use CSLA 2.1. The samples that I downloaded have the objects one to a file, e.g. Project.cs, Resource.cs.
I'd like to see examples of these sames files, but split into partial class and base class versions. Are such examples available anywhere?
Hi Dave
Partial classes are really no different from normal classes except they have a partial keyword which allows you to have the class definition split across multiple files.
Really the big advantage of this is if you're using code generation so that you can generate some code but put your own edits in a separate (untouched by code generation) file.
If you look on the CSLAContrib there's the C# (and VB too, I think) CodeSmith templates that do a good job of this. If you define your CSLA BOs in an XML file you can use the CslaXml template to generate everything - and that allows split classes - you select whether you want to generate the generated or user classes. These templates also have a set of delegates that allow you to hook in to the generated code should you need to at strategic points.
HTH
Craig
Copyright (c) Marimer LLC