Dynamic Object is Sliverlight4/Csla

Dynamic Object is Sliverlight4/Csla

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

KevinKlasman posted on Monday, April 12, 2010

My application has a need for dynamic editable objects and of course, I want to use Csla. I've searched this forum for dynamic object properties and most if not all of the posts are rather old, and none of the solutions appear to work in Silverlight as neither ITypedList nor ICustomTypeDescriptor are supported AFAIK.

It looks like the EntitySpaces folks have solved this problem. See http://www.entityspaces.net/blog/2010/02/25/EntitySpaces+2010+Ndash+Killer+Silverlight+Binding.aspx

Will Csla have this feature too, and soon? As an old post suggested, RegisterDynamicProperty would seem to address this issue.



KevinKlasman replied on Monday, April 12, 2010

Oops...I transposed characters in the title...of course, it should be Silverlight.

I also just came across documentation on DynamicObject and ExpandoObject in .NET 4 (Dynamic Language Runtime, or DLR). Both DynamicObject and ExpandoObject is listed as supported in the Silverlight 4 RC docs (although it is noted as pre-release.) See http://msdn.microsoft.com/en-us/library/dd487588(v=VS.96).aspx

It sounds like we're getting close to where I (we?) need to be.

RockfordLhotka replied on Monday, April 12, 2010

Dynamic objects by themselves are not very useful. They basically give C# the late binding concepts from VB.

The expando objects might be helpful - it mostly depends on whether data binding can handle the concept.

I haven't explored integration of expando objects into CSLA at this point. The primary question is whether the dynamically created getter/setter can invoke GetProperty and SetProperty - if that's possible then it should be fine.

Obviously some intelligence would be required to do the appropriate RegisterProperty calls to define the metadata for the dynamic properties - and they'd have to be consistent from that point forward for that particular type.

KevinKlasman replied on Tuesday, April 13, 2010

Dynamic objects not very useful? Without Csla support I'd have to agree. Two very important parts of my Silverlight app require them, at least conceptually. Do you have any other suggestions for an SL4 app?

RockfordLhotka replied on Tuesday, April 13, 2010

To reiterate:


I haven't explored integration of expando objects into CSLA at this point.

I'm always happy to accept help from people interesting in specific areas of functionality, including contributions toward making CSLA better.

(CSLA 4 exists in its present form thanks to a lot of work by Jonny, Sergey, Ricky and Justin)

I won't have time to look into this in the near future - my priority right now is to get the new authorization rules functionality done and get CSLA 4 on a solid beta->release track ASAP.

If you can identify the changes required for CSLA to support the expando object concept it is certainly something that would be nice to include in 4.1.

rfcdejong replied on Thursday, October 28, 2010

Rocky, as u say, supporting the expando object..

Did u mean extending the csla objects to be usable as an "dynamic" object?
Something like i tried to start an discussion about in http://forums.lhotka.net/forums/t/9649.aspx

We've want to provide customers an meta-tool to create their own interface, workflow, etc.. so custom fields, using pre-defined business rules, and the possibility of injecting their own custom business rules. It's all not very clear and it's alot of work. Something like between 10.000 and 15.000 man hours, but i'm just going to extend 'our framework' on top of csla with dynamic possibility's. I see some issues not being able to use the FieldManager and to register IPropertyInfo's so standard functionality will continue to work.

Since u say this concept is certainly something that would be nice to include in 4.1 i wonder..

RockfordLhotka replied on Thursday, October 28, 2010

This isn't something I'm looking at for 4.1, sorry if I implied that. Version 4.1 is all about WP7 support (and a few other enhancements/bug fixes of course - but all time-constrained by the WP7 release in Oct/Nov).

OscarLauroba replied on Wednesday, March 09, 2011

Hi Rocky,

I'm very interested in knowing if csla supports developing business classes whose properties are known at run time. Actually, about 80% of our application is based on this requirement, so this is critical for me. The user selects what table wants to edit from a list. These tables have been designed by the user, so I don't know what fields the table has until I have a datareader as a result of a Select * From TableSelected , for instance. Once I know what fields are contained in the table I need to create one property for each field and show them dynamically in a silverlight application. Of course, business rules are also known at run time.

Is Expando Objects the way to go? Is it better to use indexed properties? Is there any silverlight example that shows how csla can manage runtime properties? One instance can have three properties but other instance of the same business class could have different properties. Does FieldManager know what properties have each instance of this "dynamic business class"? Any recommendation will be appreciated.


Copyright (c) Marimer LLC