mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-16 02:02:55 -07:00
Tidied up the bootstrapper
This commit is contained in:
parent
664dae23fd
commit
9450127893
3 changed files with 75 additions and 25 deletions
|
@ -43,7 +43,6 @@ using PlexRequests.Api.Interfaces;
|
|||
using PlexRequests.Core;
|
||||
using PlexRequests.Core.SettingModels;
|
||||
using PlexRequests.Helpers;
|
||||
using PlexRequests.Services;
|
||||
using PlexRequests.Services.Interfaces;
|
||||
using PlexRequests.Services.Notification;
|
||||
using PlexRequests.Store;
|
||||
|
@ -168,31 +167,33 @@ namespace PlexRequests.UI
|
|||
container.Register<IRepository<UsersModel>, UserRepository<UsersModel>>();
|
||||
container.Register<IUserMapper, UserMapper>();
|
||||
container.Register<ICustomUserMapper, UserMapper>();
|
||||
container.Register<ISettingsService<EmailNotificationSettings>, SettingsServiceV2<EmailNotificationSettings>>();
|
||||
container.Register<ISettingsService<PushbulletNotificationSettings>, SettingsServiceV2<PushbulletNotificationSettings>>();
|
||||
container.Register<ISettingsService<PushoverNotificationSettings>, SettingsServiceV2<PushoverNotificationSettings>>();
|
||||
container.Register<ISettingsService<SlackNotificationSettings>, SettingsServiceV2<SlackNotificationSettings>>();
|
||||
container.Register<ISettingsService<ScheduledJobsSettings>, SettingsServiceV2<ScheduledJobsSettings>>();
|
||||
|
||||
// Settings
|
||||
container.RegisterSetting<EmailNotificationSettings>();
|
||||
container.RegisterSetting<PushbulletNotificationSettings>();
|
||||
container.RegisterSetting<PushoverNotificationSettings>();
|
||||
container.RegisterSetting<SlackNotificationSettings>();
|
||||
container.RegisterSetting<ScheduledJobsSettings>();
|
||||
container.RegisterSetting<PlexRequestSettings>();
|
||||
container.RegisterSetting<CouchPotatoSettings>();
|
||||
container.RegisterSetting<AuthenticationSettings>();
|
||||
container.RegisterSetting<PlexSettings>();
|
||||
container.RegisterSetting<SonarrSettings>();
|
||||
container.RegisterSetting<SickRageSettings>();
|
||||
container.RegisterSetting<HeadphonesSettings>();
|
||||
container.RegisterSetting<LogSettings>();
|
||||
container.RegisterSetting<LandingPageSettings>();
|
||||
|
||||
// Repository
|
||||
container.RegisterRepo<LogEntity>();
|
||||
container.RegisterRepo<UsersToNotify>();
|
||||
container.RegisterRepo<ScheduledJobs>();
|
||||
container.RegisterRepo<IssueBlobs>();
|
||||
|
||||
|
||||
// Notification Service
|
||||
container.Register<INotificationService, NotificationService>().AsSingleton();
|
||||
// Settings
|
||||
container.Register<ISettingsService<PlexRequestSettings>, SettingsServiceV2<PlexRequestSettings>>();
|
||||
container.Register<ISettingsService<CouchPotatoSettings>, SettingsServiceV2<CouchPotatoSettings>>();
|
||||
container.Register<ISettingsService<AuthenticationSettings>, SettingsServiceV2<AuthenticationSettings>>();
|
||||
container.Register<ISettingsService<PlexSettings>, SettingsServiceV2<PlexSettings>>();
|
||||
container.Register<ISettingsService<SonarrSettings>, SettingsServiceV2<SonarrSettings>>();
|
||||
container.Register<ISettingsService<SickRageSettings>, SettingsServiceV2<SickRageSettings>>();
|
||||
|
||||
container.Register<ISettingsService<HeadphonesSettings>, SettingsServiceV2<HeadphonesSettings>>();
|
||||
container.Register<ISettingsService<LogSettings>, SettingsServiceV2<LogSettings>>();
|
||||
container.Register<ISettingsService<LandingPageSettings>, SettingsServiceV2<LandingPageSettings>>();
|
||||
|
||||
// Repo's
|
||||
container.Register<IRepository<LogEntity>, GenericRepository<LogEntity>>();
|
||||
container.Register<IRepository<UsersToNotify>, GenericRepository<UsersToNotify>>();
|
||||
container.Register<IRepository<ScheduledJobs>, GenericRepository<ScheduledJobs>>();
|
||||
container.Register<IRepository<IssueBlobs>, GenericRepository<IssueBlobs>>();
|
||||
container.Register<IRequestService, JsonRequestModelRequestService>();
|
||||
container.Register<IIssueService, IssueJsonService>();
|
||||
container.Register<ISettingsRepository, SettingsJsonRepository>();
|
||||
|
|
48
PlexRequests.UI/Helpers/ContainerHelper.cs
Normal file
48
PlexRequests.UI/Helpers/ContainerHelper.cs
Normal file
|
@ -0,0 +1,48 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: ContainerHelper.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
using Nancy.TinyIoc;
|
||||
|
||||
using PlexRequests.Core;
|
||||
using PlexRequests.Core.SettingModels;
|
||||
using PlexRequests.Store;
|
||||
using PlexRequests.Store.Repository;
|
||||
|
||||
namespace PlexRequests.UI.Helpers
|
||||
{
|
||||
public static class ContainerHelper
|
||||
{
|
||||
public static void RegisterSetting<T>(this TinyIoCContainer container) where T : Settings, new()
|
||||
{
|
||||
container.Register<ISettingsService<T>, SettingsServiceV2<T>>();
|
||||
}
|
||||
|
||||
public static void RegisterRepo<T>(this TinyIoCContainer container) where T : Entity, new()
|
||||
{
|
||||
container.Register<IRepository<T>, GenericRepository<T>>();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -159,6 +159,7 @@
|
|||
<ItemGroup>
|
||||
<Compile Include="Bootstrapper.cs" />
|
||||
<Compile Include="Helpers\BaseUrlHelper.cs" />
|
||||
<Compile Include="Helpers\ContainerHelper.cs" />
|
||||
<Compile Include="Helpers\HeadphonesSender.cs" />
|
||||
<Compile Include="Helpers\EmptyViewBase.cs" />
|
||||
<Compile Include="Helpers\ServiceLocator.cs" />
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue