コード例 #1
0
 //generic method that will extend dynamically the type T. keeping a global variable that holds the dynamic type
 //makes sure I create type only once (the class on the other hand has to be instantiated for each data-row
 protected Type GetExtendedType <T>(Dictionary <string, Type> extendedPropertiesDict) where T : class
 {
     if (extendedType == null)
     {
         extendedType = DynamicFactory.ExtendTheType <T>(extendedPropertiesDict);
     }
     return(extendedType);
 }
コード例 #2
0
        public PresentingData CreatePresentable(dynamic src, Dictionary <string, Type> extendedPropertiesDict)
        {
            //create the dynamic type & class based on the dictionary - hold the extended class in a variable of the base-type
            PresentingData classicEx = DynamicFactory.CreateClass <PresentingData>(GetExtendedType <PresentingData>(extendedPropertiesDict));

            //fill in the base-type's properties
            classicEx.Composer    = src.ComposerName;
            classicEx.Composition = src.CompositionName;
            classicEx.Orquestra   = src.Orquestra;
            classicEx.Conductor   = src.Conductor;
            //fill in the dynamically created properties
            SetExtendedProperties(classicEx as dynamic, src, extendedPropertiesDict);
            return(classicEx);
        }