Responsible creating an instance that can be passed to helper classes that need to access the TextTransformation members. It accesses member by name and signature rather than by type. This is necessary when the template is being used in Preprocessed mode and there is no common known type that can be passed instead
Example #1
0
 public CodeGenTools(object textTransformation)
 {
     if (textTransformation != null)
     {
         _textTransformation = DynamicTextTransformation.Create(textTransformation);
     }
 }
Example #2
0
 public CodeGenTools(object textTransformation)
 {
     if (textTransformation != null)
     {
         _textTransformation = DynamicTextTransformation.Create(textTransformation);
     }
 }
        /// <summary>
        /// Creates an instance of the DynamicTextTransformation class around the passed in
        /// TextTransformation shapped instance passed in, or if the passed in instance
        /// already is a DynamicTextTransformation, it casts it and sends it back.
        /// </summary>
        public static DynamicTextTransformation Create(object instance)
        {
            if (instance == null)
            {
                throw new ArgumentNullException("instance");
            }

            DynamicTextTransformation textTransformation = instance as DynamicTextTransformation;

            if (textTransformation != null)
            {
                return(textTransformation);
            }

            return(new DynamicTextTransformation(instance));
        }