コード例 #1
0
        private void AppendHeader(StringBuilder ret, List <GenInfo> infoList)
        {
            var usingManager = new UsingManager();

            foreach (var info in infoList)
            {
                usingManager.AddUsingOf(info.Concrete);
                info.InterfaceList.ForEach(usingManager.AddUsingOf);
            }
            foreach (var uzing in usingManager.Result)
            {
                ret.Append($"using {uzing};\r\n");
            }

            ret.Append(
                $@"using Library.CommonIoc.Interface;

namespace {_containerNs}
{{
    class IocConfigGen
    {{
//########################### this is a generated file ##############################
        public static void Config(IIocContainerBuilder b, IocTypesGen t)
        {{
            ");
        }
コード例 #2
0
        private void AppendHeader(StringBuilder ret, List <GenInfo> infoList)
        {
            var usingManager = new UsingManager();

            foreach (var info in infoList)
            {
                usingManager.AddUsingOf(info.Concrete);
                info.InterfaceList.ForEach(usingManager.AddUsingOf);
            }

            foreach (var uzing in usingManager.Result)
            {
                ret.Append($"using {uzing};\r\n");
            }
            ret.Append($@"
using Pendar.CommonTest.SpyFramework;
using Pendar.CommonTest.SpyFramework.Interface;
using {_iocTypesNs};
using {_spiesNs};
using Pendar.CommonTest.Ioc;

namespace {_spyIocConfigNs}
{{
    class SpyIocConfigGen
    {{
//########################### this is a generated file ##############################
        public static void Configure(ISpyIocContainerBuilder c, IocTypesGen t)
        {{
            ");
        }
コード例 #3
0
ファイル: Extractor.cs プロジェクト: mjfard/IocSpy
        private List <IMemberInfo> ProcessInterface(Type @interface, string interfaceGenericName)
        {
            _usingManager.AddUsingOf(@interface);
            var ret = new List <IMemberInfo>();

            var methods = @interface
                          .GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.DeclaredOnly)
                          .Where(m => !m.IsSpecialName).ToList();

            foreach (var m in methods)
            {
                ret.Add(ProcessMethod(m, interfaceGenericName));
            }

            foreach (var prop in @interface.GetProperties())
            {
                ret.Add(ProcessProp(prop, interfaceGenericName));
            }

            return(ret);
        }
コード例 #4
0
ファイル: IocTypesGenerator.cs プロジェクト: mjfard/IocSpy
        private void AppendHeader(StringBuilder ret, List <Type> concreteTypeList)
        {
            var usingManager = new UsingManager();

            foreach (var type in concreteTypeList)
            {
                usingManager.AddUsingOf(type);
            }
            foreach (var uzing in usingManager.Result)
            {
                ret.Append($"using {uzing};\r\n");
            }
            ret.Append(
                $@"using System;
//########################### this is a generated file ##############################
namespace {_ns}
{{
    public class IocTypesGen
    {{
");
        }