Beispiel #1
0
 public CodeGenFile CreateFactoryEnumCodeGenFile(FactoryKeyEnumData data)
 {
     return(new CodeGenFile(
                data.GetFilename(),
                data.ReplaceTemplateTokens(ENUM_TEMPLATE),
                GENERATOR_NAME));
 }
Beispiel #2
0
        private IEnumerable <CodeGeneratorData> GetFactoryEnumCodeGeneratorData(IEnumerable <Type> types)
        {
            return(types
                   .Where(
                       x => x.IsEnum &&
                       x.GetCustomAttributes(typeof(FactoryKeyEnumForAttribute), false).Length > 0)
                   .SelectMany(
                       y =>
            {
                var attrData = (FactoryKeyEnumForAttribute[])y.GetCustomAttributes(
                    typeof(FactoryKeyEnumForAttribute),
                    false);

                return attrData.Select(
                    z =>
                {
                    var data = new FactoryKeyEnumData(y, z.ValueType);
                    return data;
                });
            }));
        }