|
| 1 | +using OpenPerpetuum.Core.DataServices.Context; |
| 2 | +using OpenPerpetuum.Core.DataServices.CQRS; |
| 3 | +using OpenPerpetuum.Core.DataServices.Database.Interfaces; |
| 4 | +using OpenPerpetuum.Core.Foundation.Processing; |
| 5 | +using SimpleInjector; |
| 6 | +using System.Collections.Generic; |
| 7 | +using System.Reflection; |
| 8 | + |
| 9 | +namespace OpenPerpetuum.Api.DependencyInstallers |
| 10 | +{ |
| 11 | + public static class PerpetuumInstaller |
| 12 | + { |
| 13 | + public static void RegisterPerpetuumApiTypes(this Container container) |
| 14 | + { |
| 15 | + IEnumerable<Assembly> asm = AssemblyLoader.Instance.RuntimeAssemblies; |
| 16 | + container.Register(typeof(ICommandHandler<>), asm); |
| 17 | + // Example of how to add decorators to the handlers via IoC -> container.RegisterDecorator(typeof(ICommandHandler<>), typeof(Extension.DecoratedHandler<>)); |
| 18 | + container.Register(typeof(IQueryHandler<,>), asm); |
| 19 | + |
| 20 | + // Manually wire the processors. These are being auto-wired to allow for inaccessible class registration |
| 21 | + container.Register<ICommandProcessor, BasicCommandProcessor>(); |
| 22 | + container.Register<IQueryProcessor, BasicQueryProcessor>(); |
| 23 | + container.Register<IIdGeneratorService, IdGeneratorService>(); |
| 24 | + container.Register<IGenericContext, GenericContext>(); |
| 25 | + container.Register<IDataContext, DataContext>(); |
| 26 | + container.Register<ICoreContext, CoreContext>(); |
| 27 | + } |
| 28 | + } |
| 29 | +} |
0 commit comments