Example #1
0
        private void ImplementGenericPlugIn(object sender, ImplementGenericTypeEventArgs e)
        {
            var dic = new Dictionary <string, object>();

            if (ServiceConfigHelper.GenericTypeInformation != null &&
                ServiceConfigHelper.GenericTypeInformation.ContainsKey(e.PluginUniqueName))
            {
                var tmp  = ServiceConfigHelper.GenericTypeInformation[e.PluginUniqueName];
                var impl = (from t in e.GenericTypes
                            join j in tmp on t.GenericTypeName equals j.TypeParameterName
                            select new { Param = t, Result = ExpressionParser.Parse(j.TypeExpression.ApplyFormat(e), dic) });
                foreach (var item in impl)
                {
                    item.Param.TypeResult = (Type)item.Result;
                }

                e.Handled = true;
            }
        }
Example #2
0
        /// <summary>
        /// Applies a string-format on a raw-type expression if required
        /// </summary>
        /// <param name="typeExpression">the type-expression found in the a configuration</param>
        /// <param name="args">the arguments that were retrieved from an event requesting generic types</param>
        /// <returns>a re-formatted string that provides a type expression</returns>

        public static string ApplyFormat(this string typeExpression, ImplementGenericTypeEventArgs args)
        {
            return(typeExpression.ApplyFormat(args.Formatter));
        }