CSLA Model Binder for MVC 2.0

CSLA Model Binder for MVC 2.0

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

divsalar posted on Tuesday, July 19, 2011

We are using the older version of CSLA.Net  (version 3.5) and due to number of issue cannot upgrade it to the latest version now. We used to have MVC 1.0 and I used CslaContrib.MVC and default  csla model binder which was fine so far. Unfortunately since we upgraded the Visual Studio to 2010, it has automatically upgraded the MVC to MVC 2 and the CSLA model binder no longer works due to ModelType, and Model properties are now deprecated because of ModelMetaData.

I am wondering if there is any model binder for MVC 2 or MVC 3 under CSLA.Net 3.5. As I mentioned above it is not possible to upgrade CSLA at this time so I have to stick with this but I am reluctant to downgrade the MVC to version 1.0 and prefer to find a binder working with CSLA 3.5

Any response to this would highly be appreciated.


Behnam Divsalar

RockfordLhotka replied on Tuesday, July 19, 2011

The CslaModelBinder class in version 3.8 (and in CSLA 4) target ASP.NET MVC 2. You should be able to take the current CSLA 4 class and use it in your older 3.5 codebase - at most with some minor modification.

divsalar replied on Wednesday, July 20, 2011

Thanks Rocky,

I have so many build failure in Csla.Web.Mvc (from CSLA 4.2.0) and my existing Csla here is the list

1)ObjectFactory does not exist in the namespace Csla.Server and LoadProperty doesn't exist in the base class

2) Rules doesn't exist in namespace Csla

3) AuthorizationActions could be found (in HasPermissionAttribute)

4) BusinessRules doesn't exist. I see the validationRule is renamed to BusinessRules but there is no static method called HasPermission (in HasPermissionAttribute)

5) IMemberInfo doesn't exist in namespace Csla.Core

There errors are repeated number of times.

I also tried with Csla 4.0 and I have less number of error failures only number 2 & 3 listed above.

Could you please let me know if there is any replacement for these new technology to make it work with the older Csla 3.5


Behnam Divsalar

divsalar replied on Wednesday, July 20, 2011

I have tried with Csla 4.0 with less number of error failures only on autotizationAction and Rules (item 2 &3 listed above)

I know Rules is the replacement of Validation and BusinessRules is the replacement for ValidationRules, but there isn but there is no static method for HasPermission even when I instantiate Csla.Validation.ValidationRules.

Many  thanks for your reponse in advance


Behnam Divsalar

RockfordLhotka replied on Thursday, July 21, 2011

In 3.5 the authorization rules functionality was in Csla.Security, and the business/validation rules were in Csla.Validation.

divsalar replied on Monday, July 25, 2011

Hi Rocky,

Just to recap I am trying  to use the Csla.Web.Mvc version 4.0 in my base code CLSA 3.5.

I am still unable to find the equivalent of CSLA 4.0 HasPermission function in CSLA 3.5. In Clsa.Web.Mvc 4.0 there is a class called HasPermissionAttributes which needs AuthorizationActions and BusinessRules.HasPermission if I change the BusinessRules to Csla.Validation as you advised I still cannot find the HasPermission function. I also cannot find action in Clsa.Security.

Please advise.


Behnam Divsalar

RockfordLhotka replied on Monday, July 25, 2011

That concept didn't really exist in 3.5, that's true. The authorization rules concept was completely changed from 3.x to 4.x. But the core concepts of authorizing the user to do things existed in 3.5 in the Csla.Security.AuthorizationRules type.

Copyright (c) Marimer LLC