.NET – Tools for working with multithreading and asynchrony – Part 2

.NET – Tools for working with multithreading and asynchrony – Part 2
5 (100%) 4 vote[s]

This article comprises the second part of my speech at the multithreading meetup. You can have a look at the first part here. In the first part, I focused on the basic set of tools used to start a thread or a Task, the ways to track their state, and some additional neat things such as PLinq. In this part, I will fix on the issues you may encounter in a multi-threaded environment and some of the ways to resolve them. Read More

.NET: Tools for working with multi-threading and asynchrony – Part 1

.NET: Tools for working with multi-threading and asynchrony – Part 1
4.9 (97.33%) 15 vote[s]

The need to do things in an asynchronous way – that is, dividing big tasks between multiple working units – was present long before the appearance of computers. However, when they did appear, this need became even more obvious. It is now 2019, and I’m writing this article on a laptop powered by an 8-core Intel Core CPU which, in addition to this, is simultaneously working on hundreds of processes, with the number of threads being even larger. Next to me, there lies a slightly outdated smartphone which I bought a couple of years ago – and it also houses an 8-core processor. Specialized web resources contain a wide variety of articles praising this year’s flagship smartphones equipped with 16-core CPUs. For less then $20 per hour, MS Azure can give you access to a 128-core virtual machine with 2 TB RAM. But, unfortunately, you cannot get the most out of this power unless you know how to control interaction between threads. Read More

New Features in Visual Studio 2019

New Features in Visual Studio 2019
4.5 (90.48%) 21 vote[s]

Microsoft has recently released the preview version of Visual Studio 2019. Like all previous editions, the latest Visual Studio comes with lots of improvements and new features that are focused on faster execution, more productivity for developers and team collaboration.

Visual Studio 2019 Banner

If you haven’t downloaded it yet, you can do it here for free: Visual Studio 2019 preview. You can then easily install and run it alongside any other edition of Visual Studio – they won’t interfere with each other and this won’t require any considerable upgrades of your OS. You can also download Visual Studio 2019 RC (Release Candidate) from the official website.

Read More

Resource Release in .NET Applications

Rate this post

In C#, there is one huge benefit, which is a drawback at the same time – an automatic garbage collection. With traditional desktop applications, this is great when a platform cleans up the whole garbage and releases memory. However, it is not always good for Web.

When we develop a Web application, Web-requests are mainly short; our code must perform small tasks and work very quickly. If we do not help a garbage collector, the server resources can exhaust in no time.

Read More

Using Expressions to Filter Data of Database

Using Expressions to Filter Data of Database
3.3 (66.67%) 9 vote[s]

I would like to start with a description of the problem that I encountered. There are entities in the database that need to be displayed as tables on the UI. The Entity Framework is used to access the database. There are filters for these table columns.

It is necessary to write a code to filter entities by parameters.

For example, there are two entities: User and Product.

Read More

What dangers can the update of .Net 4.6.1 to .Net 4.6.2 hide?

What dangers can the update of .Net 4.6.1 to .Net 4.6.2 hide?
4 (80%) 1 vote[s]

In this article, I would like to share a solution of unexpected problem occurred in one of the projects I am currently working on.

What dangers can the update of .Net 4.6.1 to .Net 4.6.2 hide? I thought that to avoid serious issues during the update to a minor version, it was enough to read the release notes. However, it turned out that Microsoft can make interesting and entertaining changes beyond release notes that can divert you on soulful summer nights and days off.

Read More

Configuration Comparison of Dependency Injection Containers (IOC)

Configuration Comparison of Dependency Injection Containers (IOC)
4.5 (90%) 8 vote[s]

I have often questioned myself which IoC container would be suitable for this or that project best. Their performance is only one side of the coin. The other side of the coin is the simplicity and speed of learning. So, I decided to compare the following containers from this point of view: Autofac, Simple Injector, StructureMap, Ninject, Unity, and Castle Windsor. In my opinion, these are the most popular IoC containers. You can find some of them in the list of the top 20 NuGet IoC packages. Also, I added a few containers based on my personal preferences. I really like Autofac and when writing this article I was reinforced in my choice in most of the cases.

In this article, I will describe the basics of the IoC containers, such as configuration and logging of components. I also want to compare the management of lifetime scope and advanced features. Code examples can be found in the LifetimeScopesExamples GitHub repository.

Read More

Another Way to Localize Application

Another Way to Localize Application
2.9 (57.14%) 7 vote[s]

I would like to introduce a simple way to localize applications. I do not like the standard mechanism with resource assemblies for the following reasons:

  1. When receiving a value of a localized string in the code, I would like to rely on OOP and compiler prompts. It is very unpleasant to generate a project on Friday evening, and on Saturday morning, to get a call from QAs working overtime that someone inattentive wrote GetResource (“asdf”) instead of GetResource (“assf”). Thus, now something crashes or is displayed incorrectly. In addition, the project is to be “put to print” on Monday… Read More

Entity Framework: (anti)pattern Repository

Entity Framework: (anti)pattern Repository
4.7 (93.33%) 3 vote[s]

A Repository mediates between the domain and data mapping layers, acting like an in-memory domain object collection. Client objects construct query specifications declaratively and submit them to Repository for satisfaction.

Entity Framework provides us with the actual implementation of the Repository patterns: DbSet<T> and UnitOfWork: DbContext. I often see colleagues using in projects their own implementation of repositories on top of the ones existing in Entity Framework.

Read More