예제 #1
0
        public static BehaviorSetting ExcludeGeneric()
        {
            var repository  = InstanceGetters.NewIndirectionAssemblyRepository();
            var indAsmInfos = repository.FindAll();
            var preps       = indAsmInfos.SelectMany(_ => _.GetTypes()).
                              Where(_ => _.GetInterface(typeof(IBehaviorPreparable).FullName) != null).
                              Where(_ => !_.IsGenericType).
                              Where(_ => _.GetConstructor(Type.EmptyTypes) != null).
                              Select(_ => Activator.CreateInstance(_)).
                              Cast <IBehaviorPreparable>();;
            var setting = new BehaviorSetting();

            foreach (var prep in preps)
            {
                setting.Include(prep);
            }
            return(setting);
        }