Beispiel #1
0
        public void Initialize()
        {
            foreach (Assembly assembly in platformProvider.GetAssemblies <ShellResourceAttribute>())
            {
                foreach (Type type in assembly.ExportedTypes)
                {
                    ServiceAttribute serviceAttribute = type.GetTypeInfo().GetCustomAttribute <ServiceAttribute>();

                    if (serviceAttribute == null)
                    {
                        continue;
                    }

                    List <string> serviceMethods = new List <string>();

                    serviceMethodMapping[serviceAttribute.ServiceName] = new Dictionary <string, MethodInfo>();

                    foreach (MethodInfo methodInfo in type.GetRuntimeMethods())
                    {
                        ServiceMethodAttribute serviceMethodAttribute = methodInfo.GetCustomAttribute <ServiceMethodAttribute>();

                        if (serviceMethodAttribute == null)
                        {
                            continue;
                        }

                        serviceMethods.Add(serviceMethodAttribute.MethodName);
                        serviceMethodMapping[serviceAttribute.ServiceName].Add(serviceMethodAttribute.MethodName, methodInfo);
                    }

                    services.Add(serviceAttribute.ServiceName, serviceMethods);
                    serviceNameTypeMapping.Add(serviceAttribute.ServiceName, type);
                }
            }
        }
Beispiel #2
0
        public virtual void Initialize()
        {
            List <Type> types = new List <Type>();

            foreach (Assembly assembly in platformProvider.GetAssemblies <ShellResourceAttribute>())
            {
                types.AddRange(assembly.ExportedTypes);
            }

            viewMapping = viewResolution.GetViewMapping(types);
        }
Beispiel #3
0
 public static IEnumerable <Assembly> GetAssemblies <T>(this IPlatformProvider platformProvider)
 {
     return(platformProvider.GetAssemblies().Where(a => a.IsDefined(typeof(T))).ToList());
 }