.net-core-3.0

Visual Studio Designer or Some Other Designer for .NET Core 3.0

泪湿孤枕 提交于 2020-01-01 03:40:11
问题 I have recently heard that the alpha version of .NET Core (.NET Core 3.0) supports Windows Forms and WPF. But the Visual Studio Designer (and Visual Studio) doesn't support the .NET Core version of Windows Forms and WPF. Is there any way to make the Visual Studio Designer(and Visual Studio) work with .NET Core 3.0 or Is there any other designer or IDE that I can use to work with .NET Core 3? The main reason I am asking this is because it is so hard (for me and others) to use Code-editors

How to call a stored procedure in EF Core 3.0 via FromSqlRaw

一世执手 提交于 2019-12-30 21:11:45
问题 I recently migrated from EF Core 2.2 to EF Core 3.0. Unfortunately, I haven't found a way to call a stored procedure that returns an entity. In EF Core 2.0 it was possible: var spParams = new object[] { "bla", "xx" }; var createdPath = ModelContext.Paths.FromSql("AddNodeWithPathProc @p0, @p1", spParams).Single(); In EF Core 3.0 the method FromSQL is replaced with FromSqlRaw . However, I didn't manage to successfully call a stored procedure and then process the value. This is useful when the

Visual Studio 2019 does not detect .Net Core 3 pre-release 9 SDK

家住魔仙堡 提交于 2019-12-25 17:48:50
问题 I only have .Net Core 3 pre-release 9 currently installed and if I want to create a new ASP.Net Core application it tells me the following. I even turned on Use previews of the .Net Core SDK in the settings and ensured that C:\Program Files\dotnet\ is at the very top of my PATH environment variable. Also I am using Visual Studio Version 16.2.4 . If I type dotnet --info it shows me the following: 回答1: You will need VS2019 Preview, not RTM, installed and up-to-date to use .NET Core 3.0 previews

WPF .NET Core Installer on VS 2019

眉间皱痕 提交于 2019-12-25 04:18:08
问题 I am looking to create an installer for a WPF application with .NET CORE 3.0 (not a console application) in Visual Studio 2019. Can you help me out with some suggestions for any third party tools or any other way it can be done? I have already looked into ClickOnce and Wix but both don't provide any option to create an installer for the above. I know there are 2 ways to publish a .NET Core application but I need to create an installer after that and I cannot find anything that will me achieve

System.Text.Json API is there something like IContractResolver

佐手、 提交于 2019-12-24 06:30:51
问题 In the new System.Text.Json; namespace is there something like IContractResolver i am trying to migrate my project away from Newtonsoft. This is one of the classes i am trying to move: public class SelectiveSerializer : DefaultContractResolver { private readonly string[] fields; public SelectiveSerializer(string fields) { var fieldColl = fields.Split(','); this.fields = fieldColl .Select(f => f.ToLower().Trim()) .ToArray(); } protected override JsonProperty CreateProperty(MemberInfo member,

JWT Authentication and Swagger with .Net core 3.0

狂风中的少年 提交于 2019-12-23 11:59:27
问题 I am developing some Web Api with .Net core 3.0 and want to integrate it with SwashBuckle.Swagger. It is working fine, but when I add JWT authentication, it does not work as I expect. To do that, I added the code below: services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new Microsoft.OpenApi.Models.OpenApiInfo { Title = "My Web API", Version = "v1" }); c.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme { Description = "JWT Authorization header using the Bearer scheme. Example: \

System.Text.Json.JsonElement ToObject workaround

丶灬走出姿态 提交于 2019-12-23 11:05:09
问题 I want to know the equivalent of the ToObject<>() method in Json.NET for System.Text.Json. Using Json.NET you can use any JToken and convert it to a class. EG: var str = ""; // some json string var jObj = JObject.Parse(str); var myClass = jObj["SomeProperty"].ToObject<SomeClass>(); How would we be able to do this with .NET Core 3's new System.Text.Json var str = ""; // some json string var jDoc = JsonDocument.Parse(str); var myClass = jDoc.RootElement.GetProperty("SomeProperty"). <-- now what

.Net Core 3 and EF Core 3 Include Problem (JsonException)

 ̄綄美尐妖づ 提交于 2019-12-22 19:23:49
问题 I'm trying to develop an application using .NET Core 3 and EF Core. I encountered an error that I could not find a solution for. I could not do on ".Net Core 3" a structure which can be simply created with PHP eloquent. Model; public NDEntityContext(DbContextOptions<NDEntityContext> options) : base(options) { } public DbSet<User> Users { get; set; } public DbSet<Order> Orders { get; set; } protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity<User>(entity =>

Using System.Windows.Forms classes in a .net core 3.0 preview9 project

别等时光非礼了梦想. 提交于 2019-12-22 05:23:07
问题 How can we use classes like Screen in a .NET Core 3.0 WPF project? There are documentation pages for .NET Core 3.0 for them, so I assumed it should work. VS and the compiler tell me that the namespace Forms does not exist in System.Windows , so it feels like the classes are not in the 3.0 sdk. There is no System.Windows.Forms package on nuget, and the "Add reference" dialog has only a System_Windows_Forms reference to the .net framework available, which sounds horribly wrong: Am I missing

Is polymorphic deserialization possible in System.Text.Json?

瘦欲@ 提交于 2019-12-22 04:37:12
问题 I try to migrate from Newtonsoft.Json to System.Text.Json. I want to deserialize abstract class. Newtonsoft.Json has TypeNameHandling for this. Is there any way to deserialize abstract class via System.Text.Json on .net core 3.0? 回答1: Please try this library I wrote as an extension to System.Text.Json to offer polymorphism: https://github.com/dahomey-technologies/Dahomey.Json If the actual type of a reference instance differs from the declared type, the discriminator property will be