CSLA .NET

Vibrant discussion about CSLA .NET and using the framework to build great business applications.

Should all classes inherit from a CSLA class?

rated by 0 users
Not Answered This post has 0 verified answers | 6 Replies | 2 Followers

Not Ranked
3 Posts
Stijn posted on Thu, Jan 10 2013 2:43 AM

I'm working on a project that uses CSLA.NET, and while I understand the basics of the framework I rarely touch that part of the code.

We have a number of classes that provide business logic and act as glue between our MVC controllers and business objects. Can these be vanilla classes or should they inherit from one of the CSLA classes? Or perhaps there's a design issue and these methods should be part of a relevant business object?

All Replies

Top 75 Contributor
124 Posts

Sounds like you are writing some ViewModels (i.e. that's the glue).
I think there is a CslaViewModelBase class that helps here with binding - worth investigating.

Not Ranked
3 Posts
Stijn replied on Thu, Jan 10 2013 5:17 AM

The classes contain no properties, only methods that manipulate data based on parameters and/or make calls to a third party webservice.

Top 75 Contributor
124 Posts

Can you show an example?

"We have a number of classes that provide business logic...." sounds like they might be candidates for being in your business layer model. 

If you wanted them to be CSLA inherited classes, what would they be?  Command objects maybe?  What are they actually doing in your user story?

Not Ranked
3 Posts
Stijn replied on Fri, Jan 11 2013 6:52 AM

They're indeed more our less our business layer.

I don't specifically want them to be CSLA inherited classes, it's just being done this way right now and I'm wondering if it's necessary.

Our flow is something like this:

  1. User visits a page on the website
  2. MVC Controller talks to the business logic, sending parameters
  3. Business logic talks to the required CSLA objects, does some extra stuff to it like sorting the data
  4. MVC controller receives the data, makes some decisions if needed and maps to viewmodels.
Top 75 Contributor
124 Posts
richardb replied on Fri, Jan 11 2013 11:30 AM

Sounds like that's a management / team choice then - do you follow the existing pattern and process or is there a good reason to NOT use the existing pattern.

Your choice - your decision.

Top 10 Contributor
9,270 Posts

If you are using CSLA to create data-centric objects (basically as an ORM) then you are missing out on most of the value of the framework.

CSLA isn't an ORM, it is designed to help you create a business layer that encapsulates all your business logic. So if you allow business logic to "leak" out of the business layer, then you are compromising your overall application architecture - at least as CSLA is designed to work.

Rocky

Page 1 of 1 (7 items) | RSS

Copyright (c) 2006-2010 Marimer LLC. All rights reserved.
Email admin@lhotka.net for support.
Powered by Community Server (Non-Commercial Edition), by Telligent Systems