Sygmond
Sygmond
CC#
Created by Sygmond on 4/17/2024 in #help
Is using a blazor component from a service a good idea?
I have a DocumentManagerComponent.razor that is used in multiple places across the app. It has an OnDelete EventCallback that is used for marking a row as deleted and in other places to directly delete a row from database. That depends of the type of page where the component is used, the event it used with different methods. The lead developer asked to remove this component from everywhere, place it in MainLayout, hook it up with a service (DocumentManagerService) and use this service to manage documents: open, view, edit, delete. Is this a good idea? Do you see any issues that would result from this? The initial goal was to have less code for implementing the component but now with a service, it doesn't look as having less code. In fact, moving the delete logic inside the service creates issues with the component not accepting different settings once initially set for a use case, probably because the same instance used for one page can't adapt well to another page where the service is used. This lead me to subscribe to an event placed inside the service and do the delete logic outside of the service. I looked around and I couldn't find any example of using a component as a service.
2 replies
CC#
Created by Sygmond on 3/29/2024 in #help
✅ Missing reference for one entity but not for another
I have two entities: Cat, Dog in Database.Entities project. If I reference this project via using Database.Entities I can type new Cat() and use it but I can't type new Dog() and it gives error that missing reference and I have to use new Database.Entities.Dog() What in the world is going on? Thank you!
18 replies
CC#
Created by Sygmond on 9/21/2023 in #help
❔ Inheritance Tricky Question
If ListPage and DetailPage have TitlebarButtons but also other buttons outside of the titlebar... than ListPageButtonSettings and DetailPageButtonSettings should inherit TitlebarButtonSettings or TitlebarButtonSettings should be a property inside of ListPageButtonSettings and DetailPageButtonSettings? Someone told me that a class should not inherit another class if the parent class is not of the same nature, like in my case, ListPageButtonSettings is not a TitlebarButtonSettings and it contains other button settings not related to titlebar.
5 replies
CC#
Created by Sygmond on 2/6/2023 in #help
❔ What’s the point of Database.BeginTransaction?
I’m trying to wrap my head around it, what is the main reason for using BeginTransaction? Is it because we want to make sure that both Save transactions are done successful before Commit or is because you have to make sure Disposing will rollback the first transaction i.e. out of two transaction? I find Disposing not Rollingback in time my transaction if I refresh the page. The class that has the logic of transactions should be Disposable also or just using a “using” block is enough? Thank you!
9 replies
CC#
Created by Sygmond on 11/25/2022 in #help
❔ IStringLocalizer with a GenericClass T in Resource filename
I'm using Microsoft.Extensions.Localization.IStringLocalizer to localize my strings via Resources and I can't find a way to use IStringLocalizer<GenericClass<T>>. The <T> seems to be the problem. I can't name my resource files GenericClass<T>...
2 replies
CC#
Created by Sygmond on 9/6/2022 in #help
Difference between nl-BE and nl_BE?
What is the major difference and why there are two cultures available in .NET, one with dash and one with underscore? I want to change my app from "nl_BE" to "nl-BE" but I can't find any article about the implications of doing this.
12 replies
CC#
Created by Sygmond on 8/18/2022 in #help
JsonSerializerSettings for ConfigurationBuilder
I have these settings in appsettings.json that IConfiguration can't bind/map them to my class correctly and I need to add a JSonSerializerSettings in order to be able to bind them.
{
"Bindings": [
{
"$type": "GrpcNativeBindingConfiguration",
"UseSsl": false,
"Name": "NativeBinding"
},
{
"$type": "GrpcWebBindingConfiguration",
"UseSsl": false,
"Name": "WebBinding"
}
]
}
{
"Bindings": [
{
"$type": "GrpcNativeBindingConfiguration",
"UseSsl": false,
"Name": "NativeBinding"
},
{
"$type": "GrpcWebBindingConfiguration",
"UseSsl": false,
"Name": "WebBinding"
}
]
}
How can I add a json serializing settings to configuration builder? I googled a lot and the only thing I found is this library: https://cachemanager.michaco.net/documentation/api/CacheManager.Core.JsonConfigurationBuilderExtensions.html
1 replies
CC#
Created by Sygmond on 8/12/2022 in #help
Inconsistent namespaces
(Solved) I'm currently working on a solution with a lot of subfolders and I noticed that the namespaces of .cs files are not reflecting the folder structure. On top of that, in some projects, i.e. the files inside "Commands" and "Queries" have the same namespace and in other projects they have wrong namespace like ending in "Messages" while the folder name is Queries. I would be able to fix this automatically in Rider by naming all namespaces according to folder structure but I'm afraid I will end up having hundreds of 10 levels long namespaces and usings. Other solution is to go in every file and understand the pattern that was used in naming the namespaces and correct the wrong ones (this will take a lot of time).
46 replies