private static void ConfigureServices(IConfiguration configuration, IServiceCollection services) { ResolveDependencies.AddServices(services, configuration); var mappingConfig = new MapperConfiguration(cfg => { cfg.AddProfile <ComicsLibraryProfile>(); }); var mapper = mappingConfig.CreateMapper(); _ = services.AddSingleton(mapper); // Add INavigationService for the application. _ = services.AddScoped(serviceProvider => { var navigationService = new NavigationService(serviceProvider); navigationService.Configure(StoreWindows.ArtistWindow, typeof(ArtistWindow)); navigationService.Configure(StoreWindows.BookWindow, typeof(BookWindow)); navigationService.Configure(StoreWindows.CharacterWindow, typeof(CharacterWindow)); navigationService.Configure(StoreWindows.CodeWindow, typeof(CodeWindow)); navigationService.Configure(StoreWindows.PublisherWindow, typeof(PublisherWindow)); navigationService.Configure(StoreWindows.SeriesWindow, typeof(SeriesWindow)); navigationService.Configure(StoreWindows.StoryWindow, typeof(StoryWindow)); navigationService.Configure(StoreWindows.StartWindow, typeof(StartWindow)); navigationService.Configure(StoreWindows.ReportWindow, typeof(ReportWindow)); return(navigationService); }); // Register all ViewModels. _ = services.AddSingleton <ComicsViewModel>(); // Register all the Windows of the applications. _ = services.AddTransient <ArtistWindow>(); _ = services.AddTransient <BookWindow>(); _ = services.AddTransient <CharacterWindow>(); _ = services.AddTransient <CodeWindow>(); _ = services.AddTransient <PublisherWindow>(); _ = services.AddTransient <SeriesWindow>(); _ = services.AddTransient <StoryWindow>(); _ = services.AddTransient <StartWindow>(); _ = services.AddTransient <ReportWindow>(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { _ = services.AddControllersWithViews() .AddNewtonsoftJson(options => { options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore; options.SerializerSettings.Converters.Add(new StringEnumConverter(new CamelCaseNamingStrategy())); } ); // In production, the Angular files will be served from this directory services.AddSpaStaticFiles(configuration => { configuration.RootPath = "ComicsStoreClient/dist"; }); //from here copied //var connSqlServer = @"Server=(localdb)\MSSQLLocalDB;Database=ComicsStoreAPI;Trusted_Connection=True;MultipleActiveResultSets=true;AttachDBFileName=D:\SQLLite\ComicsStoreAPI.mdf"; ResolveDependencies.AddServices(services, Configuration); var mappingConfig = new MapperConfiguration(cfg => { cfg.AddProfile <ComicsStoreProfile>(); }); var mapper = mappingConfig.CreateMapper(); _ = services.AddSingleton(mapper); _ = services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Title = "ComicsStoreAPI", Version = "v1" }); }); _ = services.AddSwaggerGenNewtonsoftSupport(); }