Entity Framework Core - DefaultValue(true) attribute not working
What is the code-first approach to set the default value of a database column in entity framework core? Using the `DefaultValue` attribute on the model doesn't seem to work ``` [DefaultValue(true)] p...
- Modified
- 14 Dec at 22:33
Is .NET Core or .NET 5.0 supported by Pythonnet
I've been using Pythonnet for quite some time but always against .NET Framework 4.* With the recent release of .NET 5.0 I wanted to migrate my projects but I could not make it work for non-Framework v...
- Modified
- 14 Dec at 01:25
Why is an explicit `this` constructor initializer required in records with a primary constructor?
In C# 9 we can create positional records causing them to get a constructor, which the spec draft calls a [primary constructor](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/propos...
- Modified
- 13 Dec at 01:49
xlrd.biffh.XLRDError: Excel xlsx file; not supported
I am trying to read a macro-enabled Excel worksheet using `pandas.read_excel` with the xlrd library. It's running fine in local, but when I try to push the same into PCF, I am getting this error: ``` ...
How can I use .NET Core in C# interactive?
How can I make the C# interactive console inside Visual Studio use .NET Core instead of .NET Framework? By default when it starts it shows that it is using .NET Framework in parenthesis in the title b...
- Modified
- 10 Dec at 10:8
c# 9.0 covariant return types and interfaces
I have two code examples: One compiles ``` class C { public virtual object Method2() => throw new NotImplementedException(); } class D : C { public override string Method2() =...
- Modified
- 2 Mar at 10:34
System.Net.HttpStatusCode not generating on DTO
In several of my models I am storing the System.Net.HttpStatusCode like so: ``` public HttpStatusCode HttpStatusCode { get; set; } ``` When generating DTO file with SS typescript service, enums that ...
- Modified
- 9 Dec at 17:49
JsonPropertyNameAttribute is not supported record from C#9?
I want to use record with JsonPropertyName attribute, but it caused an error. This is not supported? Any workaround? ``` public record QuoteResponse([JsonPropertyName("quotes")] IReadOnlyCollection<Qu...
- Modified
- 9 Dec at 15:18
Microsoft Visual Studio 2019: The project file cannot be opened. Unable to locate the .NET SDK
I just upgraded my visual studio to latest version and suddenly I am not able to load any C# project and getting the following error for all .NET core projects: > The project file cannot be opened. ...
- Modified
- 21 Dec at 08:2
ServiceStack (5.5.0) - When testing a ServiceStackController Gateway is null and throws an exception
Using ServiceStack (v 5.5.0) I read the recommended approach to calling services via a controller is by using the Gateway. Full example is found at [https://github.com/RhysWilliams647/ServiceStackCont...
- Modified
- 8 Dec at 15:48
Issue with scaffolding a MySql database with EF Core - Method not found: Void Microsoft.EntityFrameworkCore.Storage.RelationalTypeMapping
I'm trying to scaffold a MySql Database code first using `MySql.Data.EntityFrameworkCore` and `Microsoft.EntityFrameworkCore` on .NET Core 3.1 in Visual Studio 2019. However, I keep getting the follow...
- Modified
- 31 May at 19:17
.Net 5 Publish Single File - Produces exe and dlls
I am using VS 2019 and .Net 5 to build a simple console application. I wanted to share this app with a friend so I tried to publish it as a single file but I keep getting some extra DLLs that the exec...
How to implement Authorization Code with PKCE for Spotify
Getting the authorization is code is working as expected, but the step of exchanging the authorization code for tokens is failing. I am trying to implement the authorization code with PKCE flow for au...
How to set the next/image component to 100% height
I have a Next.js app, and I need an image that fills the full height of its container while automatically deciding its width based on its aspect ratio. I have tried the following: ``` <Image src="...
- Modified
- 6 Jan at 18:28
ServiceStack Messaging API: Using HostContet.AppHost.ExecuteMessage in OnAfterInit gives NullReferenceException
As previously [discussed here](https://stackoverflow.com/questions/64562749/servicestack-reinstate-pipeline-when-invoking-a-service-manually), I am sometimes using this approach to execute Services in...
- Modified
- 4 Dec at 16:33
Converting int to int? possible update?
I built my project locally and it worked with a code similar to the following: ``` bool success = true; int y = 0; int? x = success ? y : null; ``` But our build machine failed with the following err...
- Modified
- 3 Dec at 19:32
How do I define the SignedOut page in Microsoft.Identity.Web?
I'm successfully signing in and out using Azure AD B2C in a Blazor Server app, but it's not clear to me the proper way to define the SignedOut page. This question seems to be more applicable to , beca...
- Modified
- 4 Dec at 16:24
How to get file from Azure storage blob in a ByteArray format using Azure.Storage.Blobs in C#
I have a requirement to get the files from Azure storage in the byte array format using new package Azure.Storage.Blobs. I am unable to find the way to do it in a C#. ``` public byte[] GetFileFromAzur...
- Modified
- 2 Dec at 21:53
Defining a property in a record twice
In C# 9, one can define a property with the same name in a record both in its primary constructor and in its body: ``` record Cat(int PawCount) { public int PawCount { get; init; } } ``` This cod...
How to get values from appsettings.json in a console application using .NET Core?
i'm creating a console application using .NET Core 3.1 and i would like to have an appsettings json to load all environment, paths, variables,... at the beginning of the execution, and then get values...
- Modified
- 2 Dec at 20:50
Servicestack Ormlite generates invalid SQL query for custom select
I am using version 4.5.14 of Servicestack ormlite here "InMaintenance" Property is ignored as it is not the "Network" table column in the database. I want to set the value of the InMaintenance prope...
- Modified
- 16 Feb at 06:34
Type Load Exception in EF Core Project
I have an ASP.NET Core 3.1 Web API application using EF Core. This is the my configuration in the `ConfigureServices` method of the `Startup` class: ``` services.AddDbContext<ApplicationContext>(optio...
- Modified
- 13 Sep at 23:33
Warning CS7022 - The entry point of the program is global code; ignoring 'Program.Main(string[])' entry point
so I have an issue where I have this warning in my Error List: Severity Code Description Project File Line Suppression State Warning CS7022 The entry point of the program is global code; ...
- Modified
- 28 Nov at 15:41
Entity Framework Core Many to Many change navigation property names
I have a table called "LogBookSystemUsers" and I want to setup many to many functionality in EF Core 5. I almost have it working but the problem is my ID columns are named `SystemUserId` and `LogBookI...
- Modified
- 15 Feb at 07:56
System.Text.Json Field Serialization in .NET 5 not shown in Swashbuckle API Definition
# Problem I'm using ASP.NET Core with .NET 5 and am using the `System.Text.Json` serializer to serialize types containing fields (like `System.Numerics.Vector3` (X, Y and Z are fields), although an...
- Modified
- 24 Mar at 09:1