.net-core-3.0

Enum type no longer working in .Net core 3.0 FromBody request object

二次信任 提交于 2019-12-19 07:54:35
问题 I have recently upgraded my web api from .Net core 2.2 to .Net core 3.0 and noticed that my requests are getting an error now when I pass an enum in a post to my endpoint. For example: I have the following model for my api endpoint: public class SendFeedbackRequest { public FeedbackType Type { get; set; } public string Message { get; set; } } Where the FeedbackType looks like so: public enum FeedbackType { Comment, Question } And this is the controller method: [HttpPost] public async Task

ASP.NET Core 3.0 not showing on Visual Studio 2019

╄→гoц情女王★ 提交于 2019-12-18 01:18:24
问题 I want to test the new Blazor server-side framework (aka Razor Components). I installed Visual Studio 2019 RC, and then the .Net Core 3.0 preview 2, following this official tutorial. After the install, I only see the ASP.NET Core 2.0 and the 2.1 on the "Create a new ASP.NET Core Web Application" page. The 3.0 is not showing up. I started to mess around, trying to install other packages from this page, uninstalled and reinstalled Visual Studio 2019, updated to the .NET Core Preview 3,

How to use class fields with System.Text.Json.JsonSerializer?

不想你离开。 提交于 2019-12-17 16:57:14
问题 I recently upgraded a solution to be all .NET Core 3 and I have a class that requires the class variables to be fields. This is a problem since the new System.Text.Json.JsonSerializer doesn't support serializing nor deserializing fields but only handles properties instead. Is there any way to ensure that the two final classes in the example below have the same exact values? using System.Text.Json; public class Car { public int Year { get; set; } // does serialize correctly public string Model

Blazor Request blocked by CORS policy on PHP API

一笑奈何 提交于 2019-12-14 02:43:16
问题 I am setting up a PHP API and a web-page based on client-side Blazor. But for some reason CORS is triggered and my login process or any requests to my PHP pages result in CORS errors. I started out testing my PHP API with a C# console app and the Blazor app, I tried using without any database access to test the functionality. The Blazor is right now running with Preview 9. The PHP version is 5.3.8. I could in theory update it, but several other active projects are running on it and I do not

Azure Function v2 and system.text.json

旧街凉风 提交于 2019-12-13 12:52:40
问题 I am trying to implement a function that uses .net core 3 (preview 9) as a target framework and uses the new System.text.json namespace. Here is my code: using System; using Microsoft.Azure.WebJobs; using Microsoft.Azure.WebJobs.Host; using Microsoft.Extensions.Logging; using System.Text.Json; namespace Backtester { public class Test { public string Author { get; set; } public string Currency { get; set; } } public static class Function { [FunctionName("Function")] public static void Run(

Stored Procedures in EF Core 3.0

情到浓时终转凉″ 提交于 2019-12-13 01:18:59
问题 How to use stored procedures in EF Core 3.0 ? I have tried the following var user = await _context.Query<User>().FromSql("EXECUTE dbo.spGeneral_Authenticate").FirstOrDefaultAsync(); var user = await _context.Query<User>().FromSqlRaw("EXECUTE dbo.spGeneral_Authenticate").FirstOrDefaultAsync(); var user = await _context.Set<User>().FromSql("EXECUTE dbo.spGeneral_Authenticate").FirstOrDefaultAsync(); var user = await _context.Set<User>().FromSqlRaw("EXECUTE dbo.spGeneral_Authenticate")

Worker - having trouble to choose the best technology [closed]

心不动则不痛 提交于 2019-12-12 09:27:42
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 3 months ago . I want to create a micro-service for parallel processing some tasks which I get via push by an Azure Service Bus. This micro-service will notify the Azure Service Bus if the task where complete with success or not. See the following diagram: I already have this three options

Share Data Through Service in ASP.NET Blazor (Client Side)

南笙酒味 提交于 2019-12-11 11:01:54
问题 I use to have a common service in MVC Application , register it as Transient service and access its value across whole application without any issue . I tried to implement same mechanism inside my client side blazor app First created a class AppState public class AppState { public string BaseUrl { get; set; } } registered as a service services.AddSingleton<AppState, AppState>(); Used in Blazor Component Index Component public class IndexComponent : ComponentBase { [Inject] HttpClient Http {

.NET Core 3.0 ConsoleLoggerFactory for SQLite

本小妞迷上赌 提交于 2019-12-11 07:46:17
问题 using latest .Net Core (3.0 preview) and EF Core (3.0 preview) looking at a few online sources I did this: Program.cs public class MainWorker : IHostedService { public static readonly ILoggerFactory ConsoleLoggerFactory = LoggerFactory.Create(builder => builder.AddConsole(); MyDbContext.cs protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { string connectionString = ... optionsBuilder .UseLoggerFactory(MainWorker.ConsoleLoggerFactory) .EnableSensitiveDataLogging

SwaggerUI with .NetCore 3.0 bearer token authorization

半城伤御伤魂 提交于 2019-12-11 04:47:36
问题 I'm trying to add authorization header into SwaggerUI api test. below is my Startup.cs public void ConfigureServices(IServiceCollection services) { services.AddControllers(); services.Configure<ApiBehaviorOptions>(options => { options.SuppressModelStateInvalidFilter = true; }); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_3_0); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Version = "v1", Title = "API", Description = "QPIN API with ASP.NET Core 3