TJacken
Avalonia UI what I need to learn?
Hi I want to create desktop app using Avalonia I'm having experience with WinForms.
I need to create application which fetch categories (simple list of Category objects class contains prop Name and IsSelected) using api and render list of categories, categories are dynamically shown (not hardcoded list).
Add button which will run operation to process selected categories. Also I need to show loading indicator when I'm waiting to fetch data, when data are presented hide loader indicator.
Is it good to set api call in modelview constructor? How should I handle this? If I have boolean value IsLoading how view should be triggered?
Can you recommand some resouces with above questions? So I can create simple app using Avalonia π
17 replies
Is having two DbContext on same base antipattern or bad approach?
In company (so there is no much freedom to do with other tools I need to solve this using EF Core), we are using CQRS with MediatR, and every command handler is wrapped in a transaction. So if something fails, we roll back the transaction. Hereβs the issue: I need to save certain data even if an exception occurs. The main data should be rolled back, but part of the data needs to be saved in the database. I know I can use two separate DB contexts to solve this issue, but is this a good approach? Is there a better way to partially commit data to the database?
3 replies
Custom HttpMessageHandler to save http request and response in DB
Hi, is it good idea to overide SendAsync method from DelegateHandler and save request and response in DB?
https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httpmessagehandler?view=net-8.0
I made custom HttpMessageHandler and inject repository in it, but when I call SaveChanges I got concurrency exception over db context when I run multiple http requests in parallel, everything is registered in DI correctly. So my question where is best place to save http request and http response in db?
42 replies
Seed data from migration
Just need opinion about seeding data from migration. Lets start, I have some data on DEV env and I want to migrate data to TEST env. I can generate SQL script from data on DEV env and put generated script in new migration under Up() method. How can I handle future delete/update data generate new migration again? Should I have delete script in Down() method? Or should I manually delete data if new migration has new data.
13 replies
SemanticKernel WebAPI proper DI
Have you ever worked with SemanticKernel in combination with WebAPI? Didn't found on github or ms docs examples there is only console applications like example.
Do you have any example or github code how to proper use SemnaticKernel in DI?
3 replies
MathPlugin in skprompt.txt file [Semantic kernel]
What is proper way to set params in skprompt.txt file to call MathPlugin.Add function:
skprompt.txt file:
I got this answer when I enter 1 and 5 for example:
You've only provided one number, which is 6. In order to calculate a sum, I'll need at least two numbers. Can you provide another number?
1 replies
Azure Open AI preserve history and load instruction files
Hi all, need advice I'm working AI chatbot and want to preserve chat history per user.
What would be best way to implement this without using database. Is there better way than creating service which holds all chat history in list and registering this service as singleton?
Also my plan is to have storage account on Azure where I would put my instruction files on blob container and when creating initial message download this files from Azure and load them as user messages for open ai service. Is there better way to load files instead of loading them in constructor of AzureOpenAIService?
4 replies
β Unit testing xUnit, NSubstitute and FluentAssertion.
Hello to everybody, do you know any good blog or some resource which describe unit testing principles with xUnit and NSubstitute.
Additional questions, what is best approach to mock database?
I have DbContext should I mock what fetching data from DbContext return or I need to populate context with fake data before running test (setup).
2 replies
β
Mask data when solft delete is applied
Hi, is there any nuget package or EF Core feature which I can configure to mask data in database when I apply solft delete?
When user request delete his data in database, due to the GDPR regulative I need to leave user data in database because of statistics data, but mask user sensitive data like first name, last name, e-mail, gender...
Do you know any nuget for this or have idea how I can do this? I know I can manually do this to update every property I need.
I suppose if nuget exists it should had custom attribute to mark data for mask after soft delete.
16 replies
β β
How do you structure AzureFunctionApp project?
I have azure function app project with few functions, logic and models are contained in folder with non meaningful name. Do you organize your folder like clean arhitecture (application, domain, infrastructure) or you create folder per function and all logic related to function is contained in files from folder?
4 replies
β Validate list of objects after reading excel file
Hi all, how would you validate data from excel file with fluent validation?
I have method which will read data from excel file and return me list of person objects. After read I call validator to validate data from excel file. Person email must be unique, so it shouldn't exist in database when I read data and it shouldn't be duplicated in excel file.
Is it good approach to inject repository in validator or just collect all emails as list and pass it to validator? If I use that approach what if someone else insert person with email in parallel with my operation?
Person class:
Person validator class:
8 replies
β
Blob trigger and save blob information in database
Hi all, first time to ask here.
How would you approach to this problem, I have endpoint in aspnet core where I send file. When file get to controller I need to upload file on Azure blob storage and save file data in database (file name, description,...). When file get at blob container it will trigger blob azure function which need to read data from database.
So flow is this:
1)
- controller get file
- file is sent to blob storage
- save file information to database
2)
- blob trigger is activated
- read file information from database
How to solve this from 1), file is uploaded to blob storage and database throw exception, so I have blob file which will trigger azure function but don't have record in database?
9 replies