Is it possible to use Entity Framework Core 6 with MongoDb?
Is it possible to use EF Core 6 in combination with a MongoDb? From what I'v gathered online, I could only find answers from a few years ago that say that it's still not possible, but nothing that was...
- Modified
- 7 Jan at 08:14
How to create MVC5 web project in visual studio 2022
I just installed Visual Studio 2022 and I wanted to create a .Net Framework standard MVC5 web application project but, surprisingly, no option exists in the visual studio 2022 startup project template...
- Modified
- 7 Jan at 04:18
How To Resolve Error: Required properties '{'Prop1', 'Prop2'}' are missing for the instance of entity type 'SomeType''?
: how to resolve this error: > Microsoft.EntityFrameworkCore.DbUpdateException: Required properties '{'Prop1', 'Prop2'}' are missing for the instance of entity type 'SomeEntity' with the key value '{I...
- Modified
- 5 Jan at 23:30
Microsoft.AspNetCore.SpaProxy 6.0.1 - ASPNETCORE_HOSTINGSTARTUPASSEMBLIES - System.UriFormatException: Invalid URI: The URI is empty
I get the following error when trying to add `Microsoft.AspNetCore.SpaProxy 6.0.1` NuGet on start: > fail: Microsoft.AspNetCore.Server.Kestrel[13] Connection id "X", Request id "Y:00000001": An unhand...
- Modified
- 5 Jan at 15:33
How to seed data in .NET Core 6 with Entity Framework?
I know how to seed data to a database with old in `startup.cs` file using my `Seeder` class with a `Seed()` method creating some initial data. ``` public void Configure(IApplicationBuilder app, IHost...
- Modified
- 4 Jan at 16:20
Unauthorized (Invalid Token) when authenticating with JWT Bearer Token after update to .NET 6
After updating the package `Microsoft.AspNetCore.Authentication.JwtBearer` from version 3.1.14 to 6.0.1, requests with authentication fail with 401 Unauthorized "invalid token". What needs to be chang...
- Modified
- 4 Jan at 13:3
Adding Entity Framework Model on Visual Studio 2022
I am using Visual Studio 2022 with.Net 6.0, I installed Entity Framework 6.4.4 after adding it when I create an Entity Framework model. I am getting a Popup message saying that. >The project's target ...
- Modified
- 1 Sep at 10:51
Getting 400 error when running basic auth test on apphost
I have an apphost ``` public class LocalTestAppHost : AppSelfHostBase { public LocalTestAppHost() : base(nameof(LocalTestAppHost), typeof(MyServices).Assembly, typeof(LocalTestAppHost).Ass...
- Modified
- 1 Jan at 19:42
How to enable cors in ASP.NET Core 6.0 Web API project?
Configured CORS in my ASP.NET Core 6.0 Web API project. But the preflight request receives a http 405 error. In other words HTTP OPTION is not allowed. Looks like cors is not enabled. I've seen exampl...
- Modified
- 28 Dec at 19:30
How to use dependency injection in WinForms
How to define dependency injection in Winforms C#? Interface ICategory: ``` public interface ICategory { void Save(); } ``` Class CategoryRepository: ``` public class CategoryRepository : ICatego...
- Modified
- 24 Dec at 22:10
Compiling C# project to WebAssembly
I need to compile a C# project to WebAssembly and be able to call some methods from JavaScript. I want to use it in an old ASP.NET MVC 4 application that needs to add some new features and I prefer to...
- Modified
- 24 Dec at 16:14
Servicestack Test: Method not found: 'Int32 ServiceStack.DataAnnotations.CustomFieldAttribute.get_Order()
Trying to build integration test with connection to db in ServiceStack. My ServiceStack app is working fine, but when I run simple test I got this error message in line:22 There is a lite cod: ``` us...
- Modified
- 21 Dec at 20:41
How to automatically create missing indexes?
``` [Alias("MyTable")] // [References(typeof(MyModelGlobalIndex))] public class MyModel { [HashKey] public new long Id { get; set; } public new long EventId { get; set; } public Meet...
- Modified
- 21 Dec at 18:26
Delete orphans in Servicestack ORMLite with junction/join table
I've got a three table keyword structure Team <- TeamKeyword -> Keyword where the middle table is the junction table (join table). I'd like to remove possible orphans from Keyword (not in use in TeamK...
- Modified
- 21 Dec at 16:19
Unable to find package Swashbuckle.AspNetCore. No packages exist with this id: Visual Studio Offline Packages
I am struggling with a project I just created on Visual Studio 2019. It's a .net C# project. When I launch the project I get this error : "Unable to find package Swashbuckle.AspNetCore. No packa...
How to inject IConfiguration in asp.net core 6
There is no Startup.cs in the web/api application any more. We used to be able to inject `IConfiguration` into that `Startup` class. ``` public class Startup { public Startup(IConfiguration config...
- Modified
- 21 Dec at 15:15
Init-only reference properties with nullable enabled in C# 10.0
I tried to use init-only properties to force client code to initialize my class when they create it, but without a constructor. It's not working as I planned. Here's the class, stripped down to illus...
- Modified
- 20 Dec at 22:38
Why in C# do I get a compiler warning CS8618 on init properties
I have this code With the following compiler warning: > [CS8618] Non-nullable property 'SomeProperty' must contain a non-null value when exiting constructor. Consider declaring the property as nullabl...
- Modified
- 6 May at 20:25
My System.CommandLine app won't build! It can't find a CommandHandler. Do I need to write it?
I am using VS 2022, .Net 6.0, and trying to build my first app using `System.CommandLine`. Problem: when I build it, I get an error > The name 'CommandHandler' does not exist in the current context Th...
- Modified
- 18 Dec at 06:53
ServiceStack OrmLite SelectMulti same table
This is a bit related to this question: [Joining same table multiple times in ServiceStack.OrmLite](https://stackoverflow.com/questions/53436421/joining-same-table-multiple-times-in-servicestack-ormli...
- Modified
- 16 Dec at 04:26
Does the Log4j security violation vulnerability affect log4net?
I have recently read about the [zero-day](https://en.wikipedia.org/wiki/Zero-day_(computing)) issue in Log4J. I work with a few applications, written with .NET, that use the [log4net](https://logging....
How to change default port no of my .NET core 6 API
I am trying to change default port from properties section of project but I am not able to see any options. I am using visual studio 2022 with .NET core 6.
- Modified
- 13 Dec at 10:42
Visual Studio 2022 build failed - but showing no errors
The only strange thing is a warning on the projects, but without any indication of what it is: [](https://i.stack.imgur.com/UvHoz.png) [](https://i.stack.imgur.com/DSaaZ.png) [](https://i.stack.imgur....
- Modified
- 11 Dec at 17:43
Foreign key created in shadow and appending random 1 to column name - ASP:NET EF Core
When I migrate my new models and data I get the following error for multiple foreign keys: >The foreign key property 'InsurancePolicy.InsuranceSubjectID1' was created in shadow state because a conflic...
- Modified
- 5 May at 16:47
Satisfy() in Fluent Assertions does not work with collections of class objects
I have a class: and a collection of objects of this class: I'd like to assert that each object's `CampusId` equals 38: But the assertion fails with the following message: Expected collection to satisf...
- Modified
- 6 May at 07:15