Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Posts by Alexei
From time to time, I am filling in some information for the Software Codidact tags and I realized that for some tags I filled the information twice. An example would be winforms which I almost cer...
Context Our team is developing a solution mainly composed of several microservices relying on ASP.NET Core. We have decided that the simplest and most cost-effective solution would be for service...
Manually editing the .fsproj file followed by dotnet build worked because some dotnet commands have an implicit restore. I think this is the fastest way to add a dependency when you know its versio...
Yes, but with some notes I think this a good idea, but we will need to provide more details and agree on some details. A tag must be named appropriately, considering Tag naming guidelines. ...
What you want would be called DbSet<>.Find() combined with eager loading of the related entities. According to the docs, eager loading is not mentioned and its sole purpose is to easily get a...
Our team is finally focusing on writing more automatic testing and one of my ex-colleagues recommended to try out the Verify library. The tool does the following: runs the test and compares the...
Note: this is mostly based on personal experience rather than benchmarks. The examples would focus on using EF with SQL Server, but some points might apply to other ORMs and relational databases T...
There are a lot of articles and presentations that show little love for ORMs. This is mainly because some queries are so complex and heavy on the database that they lead to significant issues in p...
I would skip the theoretical part of actually computing the cyclomatic complexity of a switch statement and mention that it can see as a bunch of if statements. Since each if adds to the complexity...
One of the legacy applications my team has to maintain has almost always this pattern for dealing with data modification: try { // get the connection // begin transaction // optional...
The way I made this work is not very quick but might provide extra benefit in the future. I have added Hangfire support to the application and use its BackgroundJob enqueuing mechanism as follows: ...
One of the legacy applications our team manages contained the following pattern (in the controller): // initialization private readonly IServiceScopeFactory _serviceScopeFactory; public FooCon...
These can be achieved in several ways, but there might be some drawbacks: through JSON serialization/deserialization: const cloned = JSON.parse(JSON.stringify(array)); The advantage is that ...
Context Our product owner has realized that some entities are duplicated from time to time and that a merge is required. This should clean up existing duplicates and also allow special users to me...
If you want to use a custom entity framework migration table, you can set it when configuring the database context as shown here: // this code belong to the database context class protected overr...
Estela's answer provides great insight about how to do it also in SQL Server. Unfortunately, there does not seem to be a build-in array functionality, so one way is to rely on strings as shown here...
I am fairly new to working with @ngrx pattern in Angular which is a state management pattern relying on Reactive Extensions. One of the convenient structures is @ngrx/entity which helps with manag...
I am guessing a little here. By not preventingdefault, the form will POST the data to the server. If you switch to AJAX you have to provide the body as per documentation. However, I do not rememb...
One way to go is probably to use some kind of transaction scope to include everything (SELECT from order and INSERT into shipment) with a high enough transaction isolation (e.g. SERIALIZABLE for SQ...
There are multiple ways to do this. Just picked two that I find more usable (not very insecure or hard to do). Use a configuration file to store the credentials mysql --defaults-extra-file=/f...
p.s. I'm not sure whether the criticism applies only to generic repositories or not. This applies to generic repositories as most of their operations (e.g. get entity by id, update the entity,...
Things you might consider to improve your code: Use nameof instead of magic strings. Example: OnPropertyChanged("User"); can be replaced with OnPropertyChanged(nameof(User));. This allows for ...
I have recently contributed to a Clean Code project and had a discussion about how to implement unit tests. The project author argues for using an in-memory database (which easily replaces the rea...
I have decided to convert a legacy database-first ASP.NET Core project to code-first. However, I have noticed that the project used the same database as another bigger project and the Entity Framew...
I think the closest thing to what the post body is suggesting is offline mode: Connected client users who do not have the SUPER privilege are disconnected on the next request, with an appropriate...