asp.net-core-3.1

asp.net core 3 rotativa startup.cs env problem

折月煮酒 提交于 2021-01-06 07:21:09
问题 Im try to use Rotativa ım follow this guide in start.cs in configure function ım add this code RotativaConfiguration.Setup(env); Severity Code Description Project File Line Suppression State Error CS1503 Argument 1: cannot convert from 'Microsoft.AspNetCore.Hosting.IWebHostEnvironment' to 'Microsoft.AspNetCore.Hosting.IHostingEnvironment' ım search this error and find this and convert my code like this RotativaConfiguration.Setup(env.WebRootPath, "Rotativa"); and its give me this error

asp.net core 3 rotativa startup.cs env problem

三世轮回 提交于 2021-01-06 07:18:26
问题 Im try to use Rotativa ım follow this guide in start.cs in configure function ım add this code RotativaConfiguration.Setup(env); Severity Code Description Project File Line Suppression State Error CS1503 Argument 1: cannot convert from 'Microsoft.AspNetCore.Hosting.IWebHostEnvironment' to 'Microsoft.AspNetCore.Hosting.IHostingEnvironment' ım search this error and find this and convert my code like this RotativaConfiguration.Setup(env.WebRootPath, "Rotativa"); and its give me this error

What is the difference between File(), PhysicalFile(), PhysicalFileResult() in ASP.NET Core?

こ雲淡風輕ζ 提交于 2021-01-05 11:34:11
问题 I am trying to build a Web API endpoint using ASP.NET core 3.1 what would allow an application to send me an id, and the response would be with the corresponding file. Here is my method [HttpGet("get")] public IActionResult Get(Guid id) { FoundFileInfo file = PathFinder.Get(id); if(file == null || !System.IO.File.Exists(file.Fullname)) { return NotFound(); } return File(file.Fullname, "image/jpeg"); } using the same code, I can return File(file.VirtualName, "image/jpeg") , new

Logging into Database using log4net and Microknights in asp.net core 3.1 didn't work

烈酒焚心 提交于 2021-01-01 04:51:14
问题 I have gone through many articles saying AdoNetAppender is not supported in .net core, but we can use MicroKnights to do the same. I am trying to achieve DB logging in .net core 3.1 application using the same but still not succeed. My log4net.config file placed in roots is as follows: <?xml version="1.0" encoding="utf-8"?> <configuration> <configSections> <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" /> </configSections> <log4net debug="true">

Razor email templates in .net standard 2.1 / Core 3.1

萝らか妹 提交于 2020-12-13 03:44:06
问题 I want to create a separate service for sending emails, this will be based on a .net core 3.1 application with its default layers (application, domain, contracts, infrastructure) Within this project, I want to create a create a class library which holds my Razor templates and parses them so the application layer can send this as an email (both HTML and non-html) after the model has been applied, however this is where i run into a problem. Every example i can find targets older .net core

Call a function on button click in Blazor/Razor - ASP.NET Core 3

大兔子大兔子 提交于 2020-12-04 09:03:46
问题 I just started learning ASP.NET Core and I was following the YouTube tutorial from Microsoft (https://www.youtube.com/watch?v=wA-3FA2kbpA&list=PLdo4fOcmZ0oW8nviYduHq7bmKode-p8Wy&index=11) and when I tried to call the function on button click, it does not work. The code is as follows: Button in HTML <button @onclick="(e => SelectProduct(product.Id))" data-toggle="modal" data-target="#productModal" class="btn btn-primary">More Info</button> @Code Element - Function void SelectProduct(string

Call a function on button click in Blazor/Razor - ASP.NET Core 3

こ雲淡風輕ζ 提交于 2020-12-04 09:02:42
问题 I just started learning ASP.NET Core and I was following the YouTube tutorial from Microsoft (https://www.youtube.com/watch?v=wA-3FA2kbpA&list=PLdo4fOcmZ0oW8nviYduHq7bmKode-p8Wy&index=11) and when I tried to call the function on button click, it does not work. The code is as follows: Button in HTML <button @onclick="(e => SelectProduct(product.Id))" data-toggle="modal" data-target="#productModal" class="btn btn-primary">More Info</button> @Code Element - Function void SelectProduct(string

I updated my .NET CORE project from 2.1 to 3.1, yet I have some errors in the class Startup

自作多情 提交于 2020-12-04 02:26:33
问题 I just updated my version of .NET CORE. I already updated all the usings however I still have an error in the satrtup class, in the method ConfigureServices, when adding the default identity. It just gives me an error saying "'IServiceCollection' does not contain a definition for 'AddDefaultIdentity and no accessible extension method 'AddDefaultIdentity...'". Here is the method: public void ConfigureServices(IServiceCollection services) { services.Configure<CookiePolicyOptions>(options => { /

I updated my .NET CORE project from 2.1 to 3.1, yet I have some errors in the class Startup

梦想的初衷 提交于 2020-12-04 02:25:39
问题 I just updated my version of .NET CORE. I already updated all the usings however I still have an error in the satrtup class, in the method ConfigureServices, when adding the default identity. It just gives me an error saying "'IServiceCollection' does not contain a definition for 'AddDefaultIdentity and no accessible extension method 'AddDefaultIdentity...'". Here is the method: public void ConfigureServices(IServiceCollection services) { services.Configure<CookiePolicyOptions>(options => { /

C# Entity Framework: Linq Filter out certain GrandChild Elements

放肆的年华 提交于 2020-11-30 01:56:31
问题 How do I filter out Grandchild elements with a Linq EF Query? This Customer has multiple transactions, and only need subchild elements with Certain ProductTypeId. Its currently bringing All ProductType Ids ignoring the filter . var result = db.Customer .Include(b => b.Transactions) .Where(a => a.Transactions.Select(c=> c.ProductTypeId== productTypeId).Any()) Sql query, that I want: select distinct c.customerName from dbo.customer customer inner join dbo.Transactions transaction on transaction