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); } } }
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); }
public static IEnumerable <Assembly> GetAssemblies <T>(this IPlatformProvider platformProvider) { return(platformProvider.GetAssemblies().Where(a => a.IsDefined(typeof(T))).ToList()); }