C#

C

C#

We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.

Join

are there any good, up-to-date books on entity framework core?

i've been reading "Entity Framework Core in Action: Second Edition", but I'm not really liking the way it's structured. I've taken a look at "Programming Entity Framework: DbContext" as well, but it was published 2012 and only seems to cover working with DbContext stuff (which is useful, but I need a more comprehensive intro to ECF). I've got a subscription to o'reilly learning so I'm looking to maximize its use. can anyone recommend a good book suited for newcomers to ECF (and maybe .net in general)...

How do I get webpack to integrate with cshtml files?

I have an ASP.NET Framework 4.8 MVC project that has cshtml files. I currently do bundling via BundleConfig.js. I need to migrate to something else because we are migrating to ASP.NET [Core] and that functionality doesn't exist there. Microsoft recommends switching to something like WebPack. I am switching to webpack now before migrating to .NET so that the amount of churn necessary for the .NET upgrade is minimized. However, I'm finding it hard to see examples of how this integrates with .cshtml files. Currently, my bundles are generated with a hash to break the cache when we deploy....

why am i getting the CS0246 error on unity for this code?

please help! im new to coding and i cannot figure this out
No description

Which API to use to manage wifi networks in console app. Currently trying ManagedNativeWifi.

Hey I was trying to scan for wifi networks and connect, disconnect to them from console app. I am currently trying out ManagedNativeWifi. The only issue is it does not provide any way to create wifi profile from scratch. So it would be awesome if there is an API which does that or I have to make my own implementation....

AngleSharp doesn't send request on SubmitForm

I'm trying to automate some tasks at uni. At this point, I'm trying to reset the times of lessons to the correct value in the online registry. I figured I'd use something more serious than manually doing http requests, ended up implementing it in AngleSharp. The issue I'm facing is that SubmitAsync runs, but doesn't actually send any requests. It's supposed to send a Post request. https://github.com/AntonC9018/ScheduleLib/blob/163a747b62e87ff24ba3cada39d73277e75bd473/src/OnlineRegistry/OnlineRegistry/PublicApi.cs#L313 ...

✅ Need Help with .NET C# Console Project (visualizing) (SOLVED)

As you can see in the Image, I get following result, on first option and second I get normal result I want, but on third and so on as you can see that Background Color is even on next line and I don't really know why... I have my own Qprint Method in my dll ```C# public void Qprint(string msg, string TextColor, string BackgroundColor) {...
No description

✅ Newtonsoft.Json JsonSerializationException

As the title says, I keep getting a JsonSerializationException. I have no idea how to view the Exception details so if anyone could tell me that'd be nice. I've followed a few tutorials on this topic, but absolutely none have worked. Two exceptions occur in System.Private.CoreLib.dll and one in Newstonesoft.Json.dll ```private async Task LoadData() { var clientJson = System.IO.File.ReadAllText(clientDataPath);...

✅ Hosting ASP.NET Core with MSSQL on a Linux VPS

Hello, I have a question regarding ASP.NET Core deployment on a Linux VPS. Is it possible to host an ASP.NET Core web application together with MSSQL on a Linux VPS without major issues? Is Docker the only viable solution for this setup? ...

✅ System.IO.IOException Being Thrown

As stated above, a System.IO.IOException is being thrown. I believe it's being thrown because the Streamwriter is trying to write to a file that "doesn't exist", but I am creating the file before that code runs. Any ideas on what could be a solution? Thanks! ``` private async Task SaveMessages(bool ForceSave = false) { Spark.DebugLog(ChatMessages.Count.ToString()); if (LogMessages || ForceSave && ChatMessages.Count >= 0)...

✅ ASP.NET Core Web API Model Creation.

I have complete the restfull api know i want to know how can i create Foreign key, on cascade delete, set varchar(100) and many more

ASP.Net Core Web API unable to connect due to CORS

Hello, I want to call my POST-request through Swagger. Yet when I send the request it gives me the following message and shuts down the application; Undocumented...

Maui TabBar Animation.

how to animation shell bottom tabbar up and down side ? and how to set isVisible for bottom tabbar ?...

✅ Is it possible to invoke the Visual Studio hot-reload programmatically?

The application creates classes at runtime in development mode and it would be really helpful if we could tell visual studio to hot reload instead of what we are doing right now where you have to go press the little flame button every time. I'm also not interested in making it work for other IDEs or non-windows platforms....

DateTime rounding struggles

While writing tests for my api, I've noticed an interesting issue. My assertion comparing an object returned by an api with a reference in the database kept failing, while they were querying the same object in the database. The difference was apparently a microsecond property of DateTime that did not make it through Json serialization, while EF core returned the full value, thus the objects were different. ...

Ef core help

Hi! Working on my first blazor project for work and habr a few questions if anyone has any help with any of them . 1. Using ef core 9 (prob) and I used ef core power tools to reverse engineer the db I have (I need a few tables for this project of the 100 or so the other projects use ). It generated the classes in the models folder but I need to add some helper functions. I kinda just added another folder and dropped a file for each and made the same partial class. What's the right way to do that ? 2. The model I'm doing in ef core 9 currently exists in ef6 (non core) and is used by many other projects . Would a good way to migrate be to use ef core 3 on this and kinda add this to the old stuff ? Or would migrating the ef6 to ef core 3 be better ? The old code is all .net is .netframework 4.7...

Handle Closing Form?

Hello, I'm having some trouble handling the closing of my form. Currently I'm using the method below, but it for some reason runs 5 times instead of just once. ```private bool Closing = false; Classes Classes = new Classes(); public MainForm()...

Paste Help

So I'm trying to make a program where you can paste the link of a youtube playlist and it copys all the individual video links from the playlist and pastes them into Cobalt Tools (if you don't know what that is, it is a program that lets you paste a youtube link into it and it turns it into a downloadable file all for free) and then pastes them all into a directory. How would I do this in JetBrains Rider?

Handle DbContext and IDbContextFactory<T> lifetime in Blazor InteractiveServer

Hi, I have some trouble getting EfCore to run properly with Blazor components and pages. I scaffolded a project using the Identity UI template and implemented business logic. I wanted to deploy a first version on production but I'm stuck with flaky instances of the DbContext. For example, the autogenerated Components/Account/Pages/Manage/Index.razor page contains the following initialization method: ```cs...

convert c# to .exe

hey, can anyone convert this file to .exe? Iwatched 10 videos, but it didn`t work. xD
Next