Tagged articles
Image from Pexels

Tagged articles - C#

Found 189 articles tagged with C#

Unit of work pattern with Dapper
Implementing unit of work pattern with Dapper in .NET 5
0
People often try to compare Dapper and Entity Framework. Although they both have same goal and that is reading and modifying the data against the database, they take completely different approach in doing so and therefore this comparison is not really valid. Entity framework is more robust as the name says framework, while Dapper is simple object mapper which is down the line set of extension methods on top of the ADO classes which allow easier manipulation with data in the database...read more
Adding display name to Enum values
Implementing additional values for Enum items in C#
0
Enums are great way do list available options for certain variable values in your code. However, they do not come without limitations and they are not suitable for all scenarios. One of those limitations are Enum value names which have restrictions similar to variable name restrictions in C#...read more
C# scripting with .NET Core global tool
Using .NET Core global tool to run C# script files
0
I assume since you are reading this article you are involved in development of applications using C# and .NET platform. Microsoft .NET and C# have been around for quite a while but there is not much talk on haw you can use C# for writing code apart from creating your projects in your IDE of choice and compiling them to executables. This is typical approach for writing robust applications and that is fine, but from time to time, this whole ceremony of creating a project, adding packages and libraries just to run for example a simple scheduled task that cleans up old logs from IIS seems like and overkill...read more
Representing available string values for parameters as list in Swagger ASP.NET Core
Valid values as list in Swagger UI in ASP.NET Core
 
0
Swagger is a great way do describe your RESTful API. In ASP.NET it is pretty easy to wire up your OpenAPI documentation with your service facade with Swashbuckle NuGet package...read more
Seeding data in EF Core using SQL scripts
Another way of seeding data in EF Core
0
Not so while ago I wrote an article on Seeding data with Entity Framework Core using migrations. This approach relies on EF Core migrations to ensure seeding of specific data is done only once using __EFMigrationsHistory table to track structural migrations as well as data seeding migrations. In large number of cases this approach works just fine and you do not need to do any adjustments or add any additional tables, just use migrations mechanism out of the box...read more
Dealing with default API versions in Swagger UI
Fixing additional routes in Swagger API when using default versions
0
Having your REST API versioned is important for evolving of the service over time. Especially if your service is exposed t multiple 3rd party clients...read more
Setting up code coverage reports in Azure DevOps pipeline
Code coverage in .NET Core projects with Azure DevOps
0
I while ago I wrote and article about Publishing .NET Core code analysis to SonarCloud from Azure build pipeline. Although SonarCloud is a great platform for analyzing your code coverage and dry code analysis, it can add additional cost to your project...read more
Validate configurations with FluentValidation in ASP.NET Core
Validating IOptions models with FluentValidaton
0
Configuration is an important part of the application. In many cases it determines how the application will behave, for example when you have different configurations per environment...read more
Mocking HttpClient in unit tests with Moq and Xunit when using IHttpClientFactory
Unit testing IHttpClientFactory by mocking HttpClient in .NET Core C#
 
0
.NET Core has done a great job by introducing interface for most of classes which makes them easy to write unit tests around them. However, there are a lot of classes that re commonly used which are not refactored in .NET Core...read more
Mocking System.IO filesystem in unit tests in ASP.NET Core
Testable filesystem operations in ASP.NET Core and C#
0
Working with file system operations like creating or deleting files and directories if quite often part of applications flow. Both .NET and .NET Core come with great out of the box classes and methods to achieve this. These classes and methods are part of System.IO name space, but unfortunately both .NET and .NET Core implementations are the same and they use static classes and method to manipulate files and directories on the host file system. ...read more
Strongly typed configuration sections with options pattern in ASP.NET Core
Loading configuration values directly to classes and use them in the runtime
0
Configuration is probably the most essential part of every application, yet we do not give much attention to it during application design and development. .NET Core has quite nice way to store configurations (usually JSON files) and already built-in extensions to access configuration values and directly cast them to a specific type...read more
Mixed model binding in ASP.NET Core using custom model binders
IModelBinder interface implementations usage for multiple source model binding
 
0
Patterns, conventions and standards are invented and enforced in order to make coding easier and more understandable for the developers, but in some cases certain patterns and conventions do not couple so easily and you have to rely on more on the actual technology you are using in order to overcome these complications. One of the cases this happens is using CQRS, especially commands and REST...read more
Handling file uploads in Swagger UI with ASP.NET Core
Swagger UI file upload in ASP.NET Core WebApi
0
Swagger is the most convenient way to document your REST api endpoints. It provides generating of documentation on the fly based on the code structure, which shortens the time of creating the documentation drastically...read more
Monitoring Redis key events in .NET Core
Key event subscriptions for DEL, SET, EXPIRED key events in Redis using .NET Core
0
Some time ago I wrote an article about Reloading the cache automatically once expired is ASP.NET MVC. The piece of code represented in that article is build on top of .NET Framework 4.7.2...read more
Stop writing clients in C# for your Web APIs
Auto generating client libraries and packages for Web API using NSwag and Azure DevOps
0
Times of writing your HttpClient setup to call REST API endpoint are over. It is just to much of repetitive code and taking care of the endpoints of the REST API service...read more

.NET

read more

JavaScript

read more

SQL/T-SQL

read more

Umbraco CMS

read more