CSLA .NET N2 3.7.1 is available

CSLA .NET N2 3.7.1 is available

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


tiago posted on Thursday, October 01, 2009

If you missed that one like I did, go to http://www.lhotka.net/cslanet/N2.aspx and read the good news. Now the same Csla version is availble on all .NET versions.

Thank you Jonny!

JonnyBee replied on Friday, October 02, 2009

Hi all,

Yes, I realize it became a silent release of CSLA 3.7.1 for N2.

CSLA 3.7.1 for N2 includes:

I suggest you read Jason Bocks article here: Creating Custom Field Data and look at his sample code for how to use this new feature. You can f.ex. alter the way IsDirty works to do an actual comparison of old/new field values (as opposed to bool flag by default) or create your own audit logging function.

CSLA 3.7.1 for N3.5 registers properties by overloads that use Expression as first parameter to get the propertyName. This is the preferred way of registering properties for CSLA for N3.5 and future versions.  In order to have equivalent function for N2 I have chosen to add similar overloads to intermediate baseclasses in MyCsla. that take a string propertyName as first parameter  These will also work even if you move your project to CSLA 3.7.1 for N3.5.

For examples on how to RegisterProperty using the new overloads (that calls PropertyInfoFactory) look at the accompanying ProjectTracker and MyCsla in samples download.

RockfordLhotka replied on Friday, October 02, 2009

I didn't mean for it to be a silent release - I kind of thought Jonny would do the post :)  Bad communication on my part...

tiago replied on Sunday, October 04, 2009

JonnyBee:
I suggest you read Jason Bocks article here: Creating Custom Field Data and look at his sample code for how to use this new feature.

Concerning Jason Bock's source code, due to changes in the final release of Csla 3.7.1-090928


Field Manager/PropertyInfo<T> (090911)
http://www.lhotka.net/cslabugs/edit_bug.aspx?id=563
Add Type parameter to Create() methods so a PropertyInfo factory has access to the
business object type that declares the property.

you must change PropertyInformationFactory.cs as follows

using System;
using Csla;
using Csla.Core;

namespace CustomFieldData
{
   
public sealed class PropertyInformationFactory : IPropertyInfoFactory
   
{
      
public PropertyInfo<T> Create<T>(Type containingType, string name, string friendlyName, T defaultValue, RelationshipTypes relationship)
      
{
         
return new PropertyInformationUsingOriginalValue<T>(name, friendlyName, defaultValue, relationship);
      
}

      
public PropertyInfo<T> Create<T>(Type containingType, string name, string friendlyName, T defaultValue)
      
{
         
return new PropertyInformationUsingOriginalValue<T>(name, friendlyName, defaultValue);
      
}

      
public PropertyInfo<T> Create<T>(Type containingType, string name, string friendlyName, RelationshipTypes relationship)
      
{
         
return new PropertyInformationUsingOriginalValue<T>(name, friendlyName, relationship);
      
}

      
public PropertyInfo<T> Create<T>(Type containingType, string name, string friendlyName)
      
{
         
return new PropertyInformationUsingOriginalValue<T>(name, friendlyName);
      
}

      public PropertyInfo<T> Create<T>(Type containingType, string name)
      {
         
return new PropertyInformationUsingOriginalValue<T>(name);
      
}
   
}
}

Copyright (c) Marimer LLC