Spaxter
Spaxter
Explore posts from servers
CC#
Created by Spaxter on 8/9/2024 in #help
✅ Transient DbContext vs DbContextFactory
Alright, that's the answer I was looking for. Thank you!
4 replies
CC#
Created by KidKai25 on 6/28/2024 in #help
✅ Is it a good idea to store CSS class as a property in my C# model?
I guess it's really a personal preference and there's nothing wrong with what you're doing, but IMO the back-end should not be responsible for any styling or other CSS/HTML related stuff, that's the front-ends job. The back-end provides data and the front-end decides how to render that data.
14 replies
CC#
Created by Spaxter on 6/19/2024 in #help
✅ EF Core - Not getting updated data from PostgreSQL table
Aright, turns out DBeaver which I'm using for editing the table was lying to me when it said the data was updated. After invalidating and reconnecting I saw that the value had in fact not changed. Changing the value with the psql CLI worked, thanks.
6 replies
CC#
Created by Spaxter on 6/19/2024 in #help
✅ EF Core - Not getting updated data from PostgreSQL table
I've tried manually disposing the context and changing to await using ( but none of those worked either
6 replies
CC#
Created by Spaxter on 6/19/2024 in #help
✅ EF Core - Not getting updated data from PostgreSQL table
No description
6 replies
CC#
Created by Spaxter on 6/19/2024 in #help
✅ EF Core - Not getting updated data from PostgreSQL table
No description
6 replies
CC#
Created by ChumpRumpkis on 6/18/2024 in #help
I'm new to C# and i need to know something
Visual Studio just has a bunch of built in stuff and works right off the bat with C#. If you're using VSCode you're going to need a bunch of extensions and configuration to get it to work with whatever project you have in mind.
66 replies
CC#
Created by Spaxter on 6/17/2024 in #help
DbContextFactory check for valid connection on app startup
I ended up solving it like this Program.cs
var contextFactory = app.Services.GetRequiredService<IDbContextFactory<DataContext>>();
using (var context = contextFactory.CreateDbContext())
{
context.Database.EnsureCreated();
}
var contextFactory = app.Services.GetRequiredService<IDbContextFactory<DataContext>>();
using (var context = contextFactory.CreateDbContext())
{
context.Database.EnsureCreated();
}
2 replies
CC#
Created by Spaxter on 10/18/2023 in #help
✅ EF Core long running query causing concurrency issues
Sounds about right, I was about to write my own version of a DbContextFactory, guess I'm glad I asked here first
9 replies
CC#
Created by Spaxter on 10/18/2023 in #help
✅ EF Core long running query causing concurrency issues
Awesome, thanks!
9 replies
CC#
Created by Spaxter on 10/18/2023 in #help
✅ EF Core long running query causing concurrency issues
Oh that's a thing? Wow, how did I not know that
9 replies
CC#
Created by Spaxter on 10/18/2023 in #help
✅ EF Core long running query causing concurrency issues
Right, but creating a new instance of the DbContext for every method call would be tough though wouldn't it?
9 replies
CC#
Created by Spaxter on 10/14/2023 in #help
✅ launchSettings.json being ignored completely
Apparently I was adding IConfiguration as a singleton in my Program.cs. Commenting that line out solved it. No idea why but I guess it fixed my issue
10 replies
CC#
Created by Spaxter on 10/14/2023 in #help
✅ Unit Testing HttpClient
Turns out it had something to do with the way BaseAddress was being parsed, managed to fix it by changing the way I add endpoints to the request URI
10 replies
CC#
Created by Spaxter on 10/14/2023 in #help
✅ launchSettings.json being ignored completely
The launchsettings is in the same directory it has always been in, the 'Properties' one. And I can not imagine that I would've overriden anything in my code.
10 replies
CC#
Created by Spaxter on 10/14/2023 in #help
✅ launchSettings.json being ignored completely
No description
10 replies
CC#
Created by Spaxter on 10/14/2023 in #help
✅ Unit Testing HttpClient
Yeah, I've tried debugging and they all look correct. The code itself works, it's just that all tests fail because of this exception being thrown
10 replies
CC#
Created by Spaxter on 10/14/2023 in #help
✅ launchSettings.json being ignored completely
No description
10 replies
CC#
Created by Spaxter on 10/14/2023 in #help
✅ Unit Testing HttpClient
Yeah, it does
10 replies
CC#
Created by Spaxter on 10/14/2023 in #help
✅ launchSettings.json being ignored completely
No description
10 replies