asp.net-core-3.0

EF Core 3.0 SumAsync triggers aggregate function exception

杀马特。学长 韩版系。学妹 提交于 2019-12-20 02:30:36
问题 I am in the process of upgrading to EF Core 3.0 and .NET Core 3.0, but some of my queries stopped working. Here is an example: I have a table called Bins , I have another table which is called BinItems , now it has, of course, a one to many relationship. BinItems has a property called Qty , and I want to sum up all the Qty from BinItems based on criteria given by the client in a filter. So here is the code: var query = _binRepository.Table; if (filter.LastRecountDate != null) { query = query

System.InvalidCastException: 'The SqlParameterCollection only accepts non-null SqlParameter type objects, not SqlParameter objects.'

核能气质少年 提交于 2019-12-19 11:06:52
问题 I migrated my project from ASP.NET Core 2.2 to ASP.NET Core 3.0. Now I get this exception. In ASP.NET Core it was using FromSql - now it is using FromSqlRaw . I am calling my procedure using Entity Framework Core. SqlParameter Username = new SqlParameter { ParameterName = "USERNAME", SqlDbType = SqlDbType.NVarChar, Value = user.Username, Direction = ParameterDirection.Input, Size = 50 }; SqlParameter Password = new SqlParameter { ParameterName = "PASSWORD", SqlDbType = SqlDbType.NVarChar,

System.InvalidCastException: 'The SqlParameterCollection only accepts non-null SqlParameter type objects, not SqlParameter objects.'

扶醉桌前 提交于 2019-12-19 11:06:09
问题 I migrated my project from ASP.NET Core 2.2 to ASP.NET Core 3.0. Now I get this exception. In ASP.NET Core it was using FromSql - now it is using FromSqlRaw . I am calling my procedure using Entity Framework Core. SqlParameter Username = new SqlParameter { ParameterName = "USERNAME", SqlDbType = SqlDbType.NVarChar, Value = user.Username, Direction = ParameterDirection.Input, Size = 50 }; SqlParameter Password = new SqlParameter { ParameterName = "PASSWORD", SqlDbType = SqlDbType.NVarChar,

System.InvalidCastException: 'The SqlParameterCollection only accepts non-null SqlParameter type objects, not SqlParameter objects.'

戏子无情 提交于 2019-12-19 11:06:06
问题 I migrated my project from ASP.NET Core 2.2 to ASP.NET Core 3.0. Now I get this exception. In ASP.NET Core it was using FromSql - now it is using FromSqlRaw . I am calling my procedure using Entity Framework Core. SqlParameter Username = new SqlParameter { ParameterName = "USERNAME", SqlDbType = SqlDbType.NVarChar, Value = user.Username, Direction = ParameterDirection.Input, Size = 50 }; SqlParameter Password = new SqlParameter { ParameterName = "PASSWORD", SqlDbType = SqlDbType.NVarChar,

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

How to set json serializer settings in asp.net core 3?

点点圈 提交于 2019-12-19 05:13:19
问题 json serializer settings for legacy asp.net core applications were set by adding AddMvc().AddJsonOptions() , but I don't use AddMvc() in asp.net core 3 . So how can I set global json serialization settings? 回答1: AddMvc returns an IMvcBuilder implementation, which has a corresponding AddJsonOptions extension method. The new-style methods AddControllers , AddControllersWithViews , and AddRazorPages also return an IMvcBuilder implementation. Chain with these in the same way you would chain with

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,

.NET Core 3.0 - Preview 2 - Razor views don't automatically recompile on change

大憨熊 提交于 2019-12-17 22:26:18
问题 According to https://docs.microsoft.com/en-us/aspnet/core/mvc/views/view-compilation?view=aspnetcore-3.0 by default razor views should recompile on change on local environments for asp.net core 3.0. However, my project doesn't do this locally. If I change a view and refresh when I'm debugging locally, the change does not reflect. I have to stop the solution, re-run, and then see the change. I am doing this on a default ASP.NET Core Web Application template on Visual Studio 2019 with asp.net

How to modify asp.net Identity UI for asp.net core WebAPI with angular

那年仲夏 提交于 2019-12-13 17:09:47
问题 I started learning .net core a few days ago and as a start, I created a .netcore project with an inbuilt angular 8 templates. It has a couple of pages built in angular, like counter and fetches data, etc, but all the Identity-related pages (login, registration, etc) are coming as a plain HTML from the backend. So "my main Concern is making some UI changes in that page". I found out that the identity has been added to the class library and hence not visible in the backend code. and In order to

Blazor.net UI not Rendering anything

寵の児 提交于 2019-12-13 03:54:55
问题 I am developing an Blaor.Net Application , taking reference from many post available on internet . The Problem i am facing that i want to move code from UI to a seprate file to keep razor file clean readable and understandable . For this i am keeping my UI side C# code into a separate component which is inherited from BaseComponent @page "/Item" @using WebApplication1.Shared @using WebApplication1.Client.Services; @inherits ItemComponent @if (ItemList != null) { <table class="table"> <thead>