T4Csla experience

Coordinator
Sep 30, 2010 at 2:43 PM

Here are some random thoughts about using T4Csla in a medium/large size project. After one month of use, my impressions are more than great. There are some minor issues, but we are already working on them.

The project is a medical application written in Borland Delphi about 10 years ago, and now we are developing new version using VS2010, EntityFramework, WindowsForms and T4Csla.

First step was to refactor database in order to fit better to the business model. After that, we created two Entity Framework models; one for business classes named MainModel ( PatientCards, Bills etc.. ), and one for editing common data named ManagementModel (Clinics, Laboratories, States etc.). Entities from the ManagementModel are also added to the MainModel , but only as read-only classes used for navigation properties (or to display read-only lookup lists). For read-only lists in the MainModel classes (eg. OrdersList), we created database views and generated ReadOnlyRootList classes in the MainModel.

I am very pleased with this approach and would recommend it to everyone using T4Csla.

After generating business classes (cca 50 business classes = 1 work day) we started developing user interface.

We extended generated classes with our partial classes in order to extend or override base functionality. Most common task was to override ToString() method in order to return something meaningful (eg. Name). Another common task was the implementation of partial AfterCreate() methods in order to populate default values. We implemented partial BeforeInsert() in order to populate values that are generated within db transaction (autoincrement identity, document numbers etc).

Some issues we run into:

-          Base class for lists is not the same for WindowsForms(BusinessBindingListBase) and WPF applications (BusinessListBase). We need to provide a way to choose base classes that are used for generated classes (adding properties to the designer). That way we can insert our own base classes between csla and our model.

-          Nullable Navigation property setters: when setting navigation properties, generated code sets also the related property that is later saved to the database. If we try to set null value to the navigation property, application throws an exception because it does not expect null value. Can be solved easily editing template and adding one line to check if value is null.

-          DataPortal_Update throws an exception when object already exists in objectcontext. This happens when an object is loaded on the DataPortal side, modified and then saved. DataPortal_Update tries to attach object using EntityKey but this is not possible because object is already attached to the context. We found the solution already and it will be solved soon.

Finally, I’m very very satisfied with T4Csla. Thank you all for your comments that helped us to develop this tool.

~Josip

Oct 5, 2010 at 8:30 PM

Hi Josip,
Thanks for writting up this. It's certainly confidence building in deciding whether to use t4csla myself.
However, I notice you're a coordinator, so realise your a bit biased but can see that any bugs you find are corrected quickly - re the DataPortal_Update issue which appears to be added to the repository already.

thanks again

John

 

Coordinator
Oct 6, 2010 at 2:55 PM

Hi John.

We try to solve all open tasks as soon as possible. Bugs do have higher priority, but any reasonable request will be solved quickly. Some guys even commented that they get better response from us then from some commercial products. Right now, there are no open tasks in our Issue Tracker.

Just to mention, this is an open source project, so anyone can contribute. Feel free to join us if you think that you can help us with this project.

My bugs are being corrected immediately just because I solve them (or in this particular case my colleague Lino) :)

~Josip