.net-core-3.0

Reading static files in ASP.NET Blazor

一曲冷凌霜 提交于 2021-01-27 12:21:53
问题 I have a client side Blazor Application. I want to have an appsetting.json file for my client-side configuration like we have an environment.ts in Angular. For that, I am keeping a ConfigFiles folder under wwwroot and a JSON file inside of it. I am trying to read this file as below. First get the path: public static class ConfigFiles { public static string GetPath(string fileName) { return Path.Combine("ConfigFiles", fileName); } } Than read it: public string GetBaseUrl() { string T = string

Reading static files in ASP.NET Blazor

拥有回忆 提交于 2021-01-27 12:21:02
问题 I have a client side Blazor Application. I want to have an appsetting.json file for my client-side configuration like we have an environment.ts in Angular. For that, I am keeping a ConfigFiles folder under wwwroot and a JSON file inside of it. I am trying to read this file as below. First get the path: public static class ConfigFiles { public static string GetPath(string fileName) { return Path.Combine("ConfigFiles", fileName); } } Than read it: public string GetBaseUrl() { string T = string

How to use Pomelo.EntityFrameworkCore.MySql provider for ef core 3 in async mode properly?

为君一笑 提交于 2021-01-07 03:56:03
问题 We are building an asp.net core 3 application which uses ef core 3.0 with Pomelo.EntityFrameworkCore.MySql provider 3.0. Right now we are trying to replace all database calls from sync to async, like: //from dbContext.SaveChanges(); //to await dbContext.SaveChangesAsync(); Unfortunetly when we do it we expereince two issues: Number of connections to the server grows significatntly compared to the same tests for sync calls Average processing speed of our application drops significantly What is

How to use Pomelo.EntityFrameworkCore.MySql provider for ef core 3 in async mode properly?

☆樱花仙子☆ 提交于 2021-01-07 03:55:09
问题 We are building an asp.net core 3 application which uses ef core 3.0 with Pomelo.EntityFrameworkCore.MySql provider 3.0. Right now we are trying to replace all database calls from sync to async, like: //from dbContext.SaveChanges(); //to await dbContext.SaveChangesAsync(); Unfortunetly when we do it we expereince two issues: Number of connections to the server grows significatntly compared to the same tests for sync calls Average processing speed of our application drops significantly What is

How to fix NuGet package Razor runtime compilation Error?

主宰稳场 提交于 2021-01-06 03:50:44
问题 After reading through several answers (.NET Core 3.0 - Preview 2 - Razor views don't automatically recompile on change) that recomend installing Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation NuGet package to get back runtime compilation, I tried the suggested solutions but the project gets the following error message simply by installing the package without even using AddRazorRuntimeCompilation(): The project "project name" must provide a value for configuration double clicking in the

How to fix NuGet package Razor runtime compilation Error?

倖福魔咒の 提交于 2021-01-06 03:44:36
问题 After reading through several answers (.NET Core 3.0 - Preview 2 - Razor views don't automatically recompile on change) that recomend installing Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation NuGet package to get back runtime compilation, I tried the suggested solutions but the project gets the following error message simply by installing the package without even using AddRazorRuntimeCompilation(): The project "project name" must provide a value for configuration double clicking in the

@onclick=“(() => SomeMethod(parameter))”

时光毁灭记忆、已成空白 提交于 2021-01-05 09:47:12
问题 I am looking into Blazor and I stumbpled on this expression: @onclick="(() => SomeMethod(parameter))" I cannot find/google anywhere what does this (I guess lambda) expression is actually doing. Can anybody explain me please this part: () => and why to use it and where? EDIT: What is the difference between the above and this: @onclick="SomeMethod(parameter)" 回答1: () =>() is basically a lambda function. Imagine you have a function delegate (int foo) { return foo*2}; this can be rewritten as

@onclick=“(() => SomeMethod(parameter))”

落爺英雄遲暮 提交于 2021-01-05 09:44:26
问题 I am looking into Blazor and I stumbpled on this expression: @onclick="(() => SomeMethod(parameter))" I cannot find/google anywhere what does this (I guess lambda) expression is actually doing. Can anybody explain me please this part: () => and why to use it and where? EDIT: What is the difference between the above and this: @onclick="SomeMethod(parameter)" 回答1: () =>() is basically a lambda function. Imagine you have a function delegate (int foo) { return foo*2}; this can be rewritten as

How to add property in existing json using System.Text.Json library?

孤街浪徒 提交于 2020-12-30 07:35:51
问题 { "TestData":{ "Year__of__Account":"2019", "Tax___x0025_":"0.06", "Buildings__1":"1000", "Contents__1":"400", "Total_Insurable_Value":"100", "Buildings__Prem":"2560.8", "Contents__Prem":"1707.2", "YB__1":"1950", "No__Buildings":"55", "Location_Sprinklers_YN":"No", "test":"test" } } In the above sample JSON I want to add a property called "Name" with Value "John" inside property "TestData". How can I achieve this using .net Core 3.0 System.Text.Json library. I have tried using methods of

C# Linq Expression could not be Translated

别来无恙 提交于 2020-12-12 03:59:13
问题 I am trying to execute a linq query to get all employes that have some specific skills. search.skills is a list of strings with some skills and I want to retrieve all the user which have all those skills (And condition). In my where clause on employees, exp.Skills is ICollection and expSkill.SkillName is the skill name .Where( emp => search.Skills.All( searchSkill => emp.Experiences.Select(exp => exp.Skills).SelectMany(x => x).Select(expSkill => expSkill.SkillName).Contains(searchSkill) ))