4
Vote

IDynamicObject or IDynamicMetaObjectProvider in DLR for Silverlight?

description

Hello!
 
We are currently implementing an application with scripting enabled using the DLR. One goal is to write a single code base for Silverlight and WPF. Most pieces work great. However, what we are missing is something like Microsoft.Scripting.Actions.IDynamicObject (from DLR SDK on codeplex) or System.Dynamic.IDynamicMetaObjectProvider (from .NET 4).
 
Here is what we try to achieve:
  1. Develop a class in C# with some built-in properties
  2. Extend the class (e.g. add properties) using user-configurable metadata DURING RUNTIME (to be exact: the scripts will be used to modify metadata)
  3. Access instances of the class from within python scripts; the scripts have to have access to both built-in AND dynamically added properties
     
    We have a working solution for WPF 3.5 and 4.0. In Silverlight we did not find a proper interface with which we can achieve what we have to build.
     
    We have already thought (and implemented) a workaround using dynamically generated types (based on ILGenerator.Emit). In this workaround we create derived classes on the fly based on metadata. This works nice with Silverlight (special feature: This way Data Binding works!). However, in our case metadata can change every now and than which results in a large number of unused dynamically generated types because once created we cannot get rid of the types any more (we do not want to create them in a separate AppDomain, too much overhead). Because of this a dynamic solution like on the full client would be preferred.
     
    It would be great if someone could point me to a possible solution. Even if you don't have one and you are sure that what we want is not possible in Silverlight 3, please drop me a line. In this case we can stop researching.
     
    Kind regards,
    Rainer

comments

mamadero wrote Dec 18, 2009 at 2:53 AM

Have you looked at Silverlight 4? It might be supported there

mamadero wrote Jan 4, 2010 at 12:10 AM

I checked and it's not support in Silverlight 4 either. Please vote here
https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=522119&wa=wsignin1.0

wrote Jan 30, 2010 at 9:32 AM

wrote Jan 30, 2010 at 1:09 PM

wrote Feb 13, 2013 at 9:09 PM