private void RegisterAttributedContent(Assembly assembly)
 {
     assembly.TryGetExportedTypes().ToList().ForEach(t =>
     {
         Attribute.GetCustomAttributes(t).Where(a => typeof(RegisterAsContentAttribute).IsAssignableFrom(a.GetType())).Cast<RegisterAsContentAttribute>().ToList().ForEach(a =>
         {
             var contentFactory = ApplicationServiceLocator.Container.Resolve(a.ContentFactoryInterface) as IContentFactory;
             contentFactory.RegisterContentFor(t, a.ContentType);
         });
     });
 }
Пример #2
0
 private void RegisterAttributedContent(Assembly assembly)
 {
     var types = assembly.TryGetExportedTypes().ToList();
     foreach (var t in types)
     {
         var attributes = t.GetTypeInfo().GetCustomAttributes<RegisterAsContentAttribute>().ToList();
         foreach (var a in attributes)
         {
             var contentFactory = ApplicationServiceLocator.Container.Resolve(a.ContentFactoryInterface) as IContentFactory;
             contentFactory.RegisterContentFor(t, a.ContentType);
         }
     }
 }