private static void RegisterMenuCommands(TinyIoCContainer container) { var items = TypeFinder.FindTypesOf(typeof(IMenuCommand), new[] { typeof(IMenuCommand).Assembly, typeof(ContainerBuilder).Assembly }); container.RegisterMultiple(typeof(IMenuCommand), items); }
private static void RegisterItems(TinyIoCContainer container) { var type = typeof(Item); var items = TypeFinder.FindTypesOf(type, type.Assembly); items = from item in items where item.IsBrowsable() orderby item.Name select item; container.RegisterMultiple(typeof(Item), items); }
private static void RegisterHandlers(TinyIoCContainer container) { var baseType = typeof(IHandler); var handlers = from handler in TypeFinder.FindTypesOf(baseType, baseType.Assembly) from @interface in handler.GetInterfaces().Where(k => k.IsGenericType) where handler.IsAbstract == false select new { Type = @interface, Implementation = handler }; foreach (var handler in handlers) { container.Register(handler.Type, handler.Implementation).AsMultiInstance(); } }