hutoanhill
updating a MySQL database from EF Core
Ive got a MySQL database i am accessing via Entity Framework Core using Pomelo.EntityFrameworkCore.MySql.
I initially generated the Data and Models based on the database, but now Ive made changes to the models (in c#) and i want to push those changes to the database.
How do i do this?
i found this but i think scafolding referss to pulling changes from the database. is that right?
53 replies
Looking for a logging solution
Working on ASP.NET program.
I have a lot of stuff i want to do for logging. First off i want to log every time an endpoint is accessed, who accessed it, when it was accessed what info was passed to the api and the datatype that the endpoint returned. Then there's all the stuff i see in the command line. i would also like to log this stuff. finally i want to be able to query some kind of database of the logs to get data about what's going on, so ideally logs have types and all that jazz. Anyone know any pre existing solutions for this?
I have a lot of stuff i want to do for logging. First off i want to log every time an endpoint is accessed, who accessed it, when it was accessed what info was passed to the api and the datatype that the endpoint returned. Then there's all the stuff i see in the command line. i would also like to log this stuff. finally i want to be able to query some kind of database of the logs to get data about what's going on, so ideally logs have types and all that jazz. Anyone know any pre existing solutions for this?
54 replies
ASP.NET Identity Login endpoint returns schema in of auth tokens
what the title says. I assume there some kind of messed up in my configuration somewhere, but i dont know where to start looking
i also assume this is because of how this method is somehow supposed to return data without returning anything...
7 replies
ASP.NET endpoint logging
I am building an ASP.NET api. I want to log info about who is accessing my API and how. I want to log the IP address of the user, the end point they called and the parameters they passed ind and the current time.
I've done some research on this already and found Serilog, adding it to my middleware
But this logs everything, I need to log less. For one thing, one of my endpoints is a login and i don't want to store passwords in the logs. For another this system logs stuff that isn't and API calls.
here's a snippet of what it captures:
22 replies
✅ IIS?
Soooo.. i tried to run my ASP.NET project and rider threw an error i had never seen before.
It said i had to set up IIS. i though what the heck, you didn't need this 20 min ago. but I clicked the link to the settings and followed the instructions.
I think i installed iis, then i wanted me to install ASP.NET Core module. I clicked the doc page and, found the Microsoft link for the install, rebooted and i am done.
but i am not. still doesn't work. While rider filled in the IIS express root folder on its own it did not fill in the ASP.NET core module file location.
1) what on earth is IIS?
2) why didn't i need it 20 min ago? only major change i made to the code was adding a hosted service
3) Where is the file location for ASP.NET Core module?
(going to sleep, then oral surgery, then more sleep, so i am going to be delayed getting back to this.)
104 replies
✅ using using to clear up ambiguous references.
I've to two method called index:
Microsoft.EntityFrameworkCore.Index
System.ComponentModel.DataAnnotations.Schema.Index
i don't use the 2nd one. I want every mention of index to be interpreted as the first one.
I've tried adding one of these using's to fix the problem, but nether works, it just says it Cannot resolve symbol 'Index'
36 replies
Trying to scaffold a MySQL database with Rider
I am trying to scaffold a MySQL database. I am using Rider. I found this article on the MySQL website:
https://dev.mysql.com/doc/connector-net/en/connector-net-entityframework-core-scaffold-example.html
but the commands it uses seems to require Visual Studio which i am not using.
then i found this article from Jetbrains themselves:
https://blog.jetbrains.com/dotnet/2022/01/31/entity-framework-core-inside-rider-ui-way/#alternatives
58 replies
Temporary Pause
I am using .NET 8
I've got an ASP.NET API that i would like to pause. The goal of this is to prevent any endpoints from being called for a short amount of time. I could do this procedurally with a constant variable that's checked, but I would rather not send nothing.
Is there some kind of HTML code i could return that would indicate that the API is offline but like on purpose? Instead of just returning nothing.
I also need a way to return this response to the user when they try to access the API while its paused. Is there a way for be to disable all the endpoints and run a default endpoint?
10 replies
✅ Windows Audio Capture
Building an XAML application. The eventual goal is to capture an audio source and stream it to another application using webhooks.
This is my first time doing:
1) XAML
2) Audio anything
3) Webhooks
i detect audio sources with this method:
Then i use these methods to start and stop recording
I added a volume bar so i could see the audio being captured and the audio bar gets set to 0 when i pick an audio source (its one if the mic is null). I think this means i am not capturing audio. but i don't actually know.
How do i even debug this?
2 replies
✅ using
I keep seeing variables defined within a using, like
what is using? why do people use it? what are the risks of not using it?
I think this just disposes of the connection variable (for sure) after its done, but i see it used mostly when dealing with databases. is there a reason for this. If my variables are within a method they get disposed at the end of the method right? How concerned should i be about this?
16 replies
How does signInManager return tokens?
I am modifying the standard login endpoint provided by
MapIdentityApi<IdentityUser>()
. at the bottem of the login endpoint: // The signInManager already produced the needed response in the form of a cookie or bearer token.
i assume this means that somehow signinManager returns its tokens to the users. I need the login endpoint to return some other data depending on the roles the user has. I've implemented this logic, but i cant figure out how to return the sign tokens as well as my data. it also looks like that even when my users don't have this role the method is not returning tokens, its just returning an empty success.
How does signInManager return tokens to the user and how can i get it to return that data to my method so i can control how its returned to the user?6 replies
API does not deploy in debug mode
when i try to test my API in debug mode it tries to open the swagger page but i get an unable to connect. the most confusing part is this doesn't happen every time, most of the time i can restart the api (still in debug mode) and it now works, but its getting more and more frequent and i am starting to be concerned.
21 replies