// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { // Add framework services. services.AddSingleton(MappingLoader.Load()); // Adds services required for using options. services.AddOptions(); // Register the IConfiguration instance which MyOptions binds against. services.Configure <AppSettings>(Configuration); services.AddMvc(); // Add application services. services.AddSingleton <IUserService, UserService>(); services.AddSingleton <IDigitalKeyService, DigitalKeyService>(); services.AddSingleton <IAuthorizationService, AuthorizationService>(); services.AddSingleton <ILockService, LockService>(); // Add repositories services.AddSingleton <IRepository <User>, MemoryRepository <User> >(); services.AddSingleton <IRepository <DigitalKey>, MemoryRepository <DigitalKey> >(); services.AddSingleton <IRepository <Authorization>, MemoryRepository <Authorization> >(); services.AddSingleton <IRepository <Lock>, MemoryRepository <Lock> >(); }
public void Execute() { var seedTypes = new Type[] { typeof(Startup) }; var assemblies = Reflect.OnTypes.GetAssemblies(seedTypes); var typesInAssemblies = Reflect.OnTypes.GetAllExportedTypes(assemblies); MappingLoader.LoadAllMappings(typesInAssemblies); }