BokoGanga
BokoGanga
CC#
Created by BokoGanga on 1/4/2023 in #help
❔ Logging Sudden Application Shutdown
Hey guys, I would like to ask if there is a possibility to log the event of an unexpected application shutdown? I'm aware of IHostApplicationLifetime which exposes OnStopping and OnStopped but they only trigger when the app is shutting down gracefully.
19 replies
CC#
Created by BokoGanga on 11/25/2022 in #help
❔ Passing a list of values to Stored Procedure in EF Core
Hey devs, I would like to know whether it is possible to pass a list of values as a parameter to a stored procedure in EF Core? I have a list of emails and I want to create a stored procedure to check whether they exist as users in a Users table, if not, create new user for each email. I want to avoid looping through the list, send request for each email to check if it exists, and then send a request creating new users. Thank you
2 replies
CC#
Created by BokoGanga on 10/24/2022 in #help
EF Core Querying a List of Rows
Hey devs, I'm trying to optimize a query that checks DB for user with email. I have a list of emails that I need to check if they exist in the table of Users. Is there anyway in EF Core that allows checking by a list instead of looping through it and sending a request for each one? Thank you.
3 replies
CC#
Created by BokoGanga on 10/19/2022 in #help
Setting the id of an object to property in a nested Object on creation
Hey devs, I have a little tricky one this time, which is possibly very simple to implement. so I have an object, let's say Question implemented like this:
class Question{
int Id;
int Order;
List<QuestionText> QuestionTexts;
}
class Question{
int Id;
int Order;
List<QuestionText> QuestionTexts;
}
and the object QuestionText has the following implementation:
class QuestionText{
string Text;
int QuestionId;
string LocaleCode;
}
class QuestionText{
string Text;
int QuestionId;
string LocaleCode;
}
What i'm trying to achieve here is to create new instances of already made ones, in other terms, clone the objects and persist them in the db. here is an example of the code i'm trying to implement:
var newQuestions = questions.Select(q => new Question()
{
Order = q.Order,
QuestionTexts = q.QuestionTexts.Select(qt => new QuestionText()
{
Text = qt.Text,
LocaleCode = qt.LocaleCode,
QuestionId = "this needs to be the id of the new instance"
})
});
var newQuestions = questions.Select(q => new Question()
{
Order = q.Order,
QuestionTexts = q.QuestionTexts.Select(qt => new QuestionText()
{
Text = qt.Text,
LocaleCode = qt.LocaleCode,
QuestionId = "this needs to be the id of the new instance"
})
});
Is there anything i'm doing wrong here or am I missing something?
6 replies
CC#
Created by BokoGanga on 10/7/2022 in #help
EF Core migrations script failing but not enough details!
Hey devs, I am trying to run a migrations script to generate a sql file for the migration but I am running into an error "cant change identity property of a column...". But there is no information regarding which migration exactly is causing this error, or table or anything. Just the error and thats it. I would like to investigate this more but I have no leads. If anyone has any idea how to expose extra details for this exception, I would be really grateful. Here is the command line i'm using:
dotnet ef migrations script --configuration Release -p .\folder\projectName.Api.csproj --no-build --context ProjectNameDbContext --idempotent -o D:\migrations\migration.sql
dotnet ef migrations script --configuration Release -p .\folder\projectName.Api.csproj --no-build --context ProjectNameDbContext --idempotent -o D:\migrations\migration.sql
14 replies
CC#
Created by BokoGanga on 8/29/2022 in #help
Reading file content from Azure Blob Storage
Hey devs, I have a an excel file stored on blob storage. I need to read its content directly in a service. I have access to the direct download url for the file. Any leads on how to read its content?
18 replies
CC#
Created by BokoGanga on 8/22/2022 in #help
Two SwaggerUI for one Solution
Hey guys, I have been looking around for a way to create two SwaggerUI for one project. I want to create a separate document just for 3 Endpoints to be displayed while the other contains all the endpoints. Is this doable? If anyone has any leads, I'd really appreciate it.
20 replies