asp.net-core-2.0

I want to place Automapper profile in my Business Layer

孤街浪徒 提交于 2019-12-11 11:04:22
问题 I've created a web api core 2.0 application. I've got my main app and the Business Layer. I want to place the automapper profile in the business layer so that all the mappings are made in the business layer. My business layer is just a class library project. Is this possible? or do I need to place all my mapping in a Profile class in the main app? Just a theoretical explanation can help. 回答1: Yes, it's possible but it depends on where the model classes reside. You can give each layer or

ASP.Net Core 2.1: How to use Gulp with npm for project dependencies

 ̄綄美尐妖づ 提交于 2019-12-11 08:43:08
问题 Now that Bower is dead with ASP.Net Core 2.0, I need to find an equally effective way to minify/inject my dependencies from npm. I installed gulp , and using npm , I'm updating all my dependencies into the node_modules folder in the root of my project. The next step is getting all the dependencies listed in my package.json file to be injected into the wwwroot folder of my project. I was going along Shawn Wildermuth's tutorial: https://wildermuth.com/2017/11/19/ASP-NET-Core-2-0-and-the-End-of

How to get appsettings from project root to IDesignTimeDbContextFactory implementation in ASP.NET Core 2.0 and EF Core 2.0

删除回忆录丶 提交于 2019-12-11 08:07:25
问题 I am building an application in ASP.NET Core 2.0 and I am having problems with EntityFramework Migrations. I have my DbContext in a separate project ( SolutionName \ ProjectNamePrefix .Data) and therefore I created an implementation for the IDesignTimeDbContextFactory interface. I wanted to use different connection strings for different environments and I need appsettings.json for that. So after a quick search I found that I can create a new IConfigurationRoot object inside the

Migrating an existing Angular4 CLI to .NET Core 2 Angular template project

只愿长相守 提交于 2019-12-11 08:06:10
问题 I have an existing Angular4 application built with the angular CLI. Developed as normal, with index.html and main.ts as it's entry points. The project users SASS for CSS. I now need to have this Angular app running inside a .NET Core web application (which I know was a headache in the past), so I know that in Visual Studio 2017, Microsoft had created new web templates especially for Angular and React. I've created a new project with the Angular template, copy & pasted the appropriate

Navbar active class resets on page load

本秂侑毒 提交于 2019-12-11 07:54:30
问题 Using bootstrap 4 and asp.net core for a personal project I've been tinkering with for the past couple of months. I've got a navbar in my _Layout that is shared across my entire site. I've also got some css that styles the navbar link text. I'm trying to change the active class on the links so the currently-visited controller is highlighted with a different color. I'm using js to do this. The color is changing initially, so I'm sure that the js is adding the active class to the new link and

Aurelia with ASP.NET Core 2.0: Unable to find module with ID: resources/index

倖福魔咒の 提交于 2019-12-11 07:32:53
问题 I created a Visual Studio 2017 ASP.NET Core 2.0 solution by using the SPA Aurelia template. Everything works fine so far but I don't get the configuration (in "boot.ts") to find my "resources/elements" folder (or it's index.ts): export function configure(aurelia: Aurelia) { aurelia.use .standardConfiguration() .feature(PLATFORM.moduleName('resources')); "Unable to find module with ID: resources/index at WebpackLoader. (aurelia-loader-webpack.js:187)" The index.ts: import {

Trigger TagHelper from another TagHelper

落爺英雄遲暮 提交于 2019-12-11 06:03:50
问题 I would like to trigger the stock ScriptTagHelper (view source on GitHub) so that it would emulate the asp-append-version="true" attribute. I know that the proper way to use this is to just change from this: <script src="somefile.js"></script> to this: <script src="somefile.js" asp-append-version="true"></script> This process is very similar for versioning CSS includes and images ( LinkTagHelper and ImageTagHelper ). Since I have a lot of included scripts, stylesheets, and images, I would

IdentityServer4 Net Core 2 not calling custom iProfileService

ⅰ亾dé卋堺 提交于 2019-12-11 04:08:57
问题 I've upgraded my Identity Server project to Net Core 2 and now I am not able to get the iProfileService object to be called to add in custom user claims. It did work in Net Core 1. Startup.cs ConfigureServices function // Add application services. services.AddTransient<IEmailSender, AuthMessageSender>(); services.AddTransient<ISmsSender, AuthMessageSender>(); services.AddTransient<IProfileService, M25ProfileService>(); //Load certificate var cert = new X509Certificate2(Path.Combine(

System.TypeLoadException Microsoft.VisualBasic ASP.NET Core 2

隐身守侯 提交于 2019-12-11 04:08:47
问题 Is the Microsoft.VisualBasic assembly not compatible with ASP.NET Core2? I have a C# class library that provides a method for reading a CSV file and I opted to use the Microsoft.VisualBasic.FileIO.TextFieldParser to read the file. The library method works great when referenced in a WPF app. However, in a ASP.NET Core2 web service, though it compiles without error, it throws an exception at runtime: Exception System.TypeLoadException Could not load type 'Microsoft.VisualBasic.FileIO

Converting IConfigurationSection to IOptions

我怕爱的太早我们不能终老 提交于 2019-12-11 03:56:51
问题 The Options pattern allowed me to create options objects containing values from configuration, as described here: https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/options?view=aspnetcore-2.1 I need the values for one option object within an IDesignTimeDbContextFactory implementation, to be used by EF when creating the models. (The values in that config section will be used for data seeding, and so I added IOptions to the DB Context constructor.) As I have no access to