Пример #1
0
        public static Type GetClasseCampo(string campo, Assembly assemblyPar = null)
        {
            var assembly = assemblyPar ?? Assembly.GetEntryAssembly();

            var nomeClasse = campo.GetPosFixo().ToLower();

            Func <Type, bool> filtro =
                (t) => t.Name.ToLower().StartsWith(nomeClasse) && t.GetProperty(campo) != null;

            var classeCampo = ClassesAssembly
                              .GetTypes(assembly, filtro)
                              .FirstOrDefault()
            ;

            return(classeCampo);
        }
Пример #2
0
        private static void InstallAssembly(IAbstractContainer container, Assembly assembly)
        {
            if (assembly == null)
            {
                return;
            }

            Logger.Debug($"assembly.FullName: {assembly.FullName}");

            ClassesAssembly
            .GetTypes(assembly, (x) => x.Name.EndsWith("BaseInstaller"))
            .ForEach(type =>
            {
                Logger.Debug($"type.FullName: {type.FullName}");

                var method = type.GetMethods().FirstOrDefault(m => m.Name.StartsWith("Add"));
                Logger.Debug($"method.Name: {method.Name}");

                ClasseExecute.Execute(type, method.Name, new[] { container });
            });
        }