
Image from Pexels
Tagged articles - dotnet core
Found 25 articles tagged with dotnet core
12
Dec
2021
Controlling the flow of migrations in EF Core
.NET229 titlesAltering EF Core migrations execution order
0
EF Core has migrations as a way of restoring the database structure inherited from Entity Framework and for the most of the cases all you have to do to setup your database structure changes when deploying your new application version is to call the Migrate method from your DbContext.Database property.
It is not a perfect solution but as I mention, it works great for majority of the cases and takes of the complexity of sorting out order for execution of pending changes so you can focus on business logic of your application.
...read more
08
May
2021
Implementing soft delete in EF Core using triggers
.NET229 titlesEntity soft delete implementation in EF Core
0
Implementation approach for soft delete is more-less straight forward thing. Instead of deleting data record, you introduce a flag which will mark the record as deleted and you can simply filter out on it and not show the data with the flag set. This way you do not loose data, but you restrict the end user to see it.
This way of "deleting" data records, or better said marking them as deleted applies for certain types of applications, but sometime this requirement may come later as a new feature while the actual delete is in place...read more
24
Apr
2021
Handling file upload in ASP.NET Core 5 with Swagger UI
.NET229 titlesGenerating proper file upload in Swagger UI for file upload in ASP.NET Core 5
0
In 2019 I worked on a REST API service which accepts files and stores them. Back then in .NET Core 2.2 I wrote custom Swagger operation filter which I described in article Handling file uploads in Swagger UI with ASP.NET Core...read more
11
Dec
2020
Representing available string values for parameters as list in Swagger ASP.NET Core
.NET229 titlesValid 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
21
Jul
2020
Seeding data with Entity Framework Core using migrations
.NET229 titlesUsing EF Core migrations to seed the data
0
As much as it is important for testing the functionality of the application, data seeding can also be used to pre-load some values like lookups not only to development and test environment but also to populate these values in production as well.
Seeding of data can be done in several ways and in this article I will go through two ways of seeding data. Both of them have their pros and cons and it is up to you to pick the way you want to have your data pre-seeded in your application database.
...read more
21
Jun
2020
Dealing with default API versions in Swagger UI
.NET229 titlesFixing 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
12
Mar
2020
Mocking HttpClient in unit tests with Moq and Xunit when using IHttpClientFactory
.NET229 titlesUnit 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
02
Mar
2020
Overwriting configuration values with environment variable in ASP.NET Core
.NET229 titlesUsing environment specific variables to overwrite configuration values in ASP.NET Core
0
It is obvious that no matter what is the size and complexity of your application, configuration values on your local development machine and the environment where the application is going to run will be different. To avoid any hard-coding and recompilation of your code, the most common practice is to store application and environment specific values to configuration files...read more
26
Oct
2019
Ignoring properties from controller action model in Swagger using JsonIgnore
.NET229 titlesExcluding properties from Swagger in controller action input model using Newtonsoft.Json package
0
While designing the REST API, quite often you may find yourself in a situation where the data can be provided from multiple sources, like route, query string or POST/PUT payload. While that might not be a big problem, it may force you to redesign your models and most likely you will end up with keeping your original DTOs but then designing a new model in your application services layer just to have all your data from different sources in one place when you are passing it to the service method.
Resolving multiple sources custom binding
...read more
01
Oct
2019
Strongly typed configuration sections with options pattern in ASP.NET Core
.NET229 titlesLoading 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
10
Sep
2019
Unit testing repositories in ASP.NET Core with xUnit and Moq
.NET229 titlesMocking UserManager RoleManager and DbContext in unit tests in .NET Core
0
Unit testing is an important part for maintaining code quality and what is the most important thing, avoiding bugs in production. This is one of the reasons why unit tests and high code coverage is desired as a part of the project and as a part of the build process since you can detect potential bugs and issues during the build process when unit tests are executed...read more
31
Aug
2019
Handling file uploads in Swagger UI with ASP.NET Core
.NET229 titlesSwagger 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
28
Aug
2019
Monitoring Redis key events in .NET Core
.NET229 titlesKey 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
08
Dec
2018
Registering multiple implementations of the same interface in ASP.NET Core
.NET229 titlesMultiple implementations of an interface in .NET Core Dependency Injection
0
Starting from it's initial release ASP .NET Core comes with built in dependency injection (DI) to help implement Inversion Of Control design pattern. This is not something new in .NET and apart from built-in DI in .NET Core, there are other libraries which provide same and in some cases even more advanced dependency injection implementation...read more
25
Nov
2018
Dependency injection with custom MVC filter attributes in ASP.NET Core
.NET229 titlesUsing dependency injection with custom ExceptionFilterAttribute in ASP.NET Core
0
Apart from adding your own middleware to the ASP.NET MVC Core application pipeline, you can control the response using custom MVC filter attributes and selectively apply them to either whole controller or controller actions.
One of the commonly used MVC filter in ASP.NET Core is ExceptionFilterAttribute for handling error response in Wep API applications. It is easy to implement and I also wrote an article about Error handling in ASP.NET Core Web API few months ago...read more
.NET
5
Jun
2022
Using dotnet nuget package vulnerability scan in Azure DevOps build
Listing nuget vulnerabilities and controlling build in Azure DevOps
5
May
2022
Protecting static files in ASP.NET Core using custom middleware
Restricting access to specific static content with middleware in ASP.NET Core
20
Dec
2021
Supporting multiple authentication schemes in asp.net core webapi
Using more than one authentication schemes in webapi projects
12
Dec
2021
Controlling the flow of migrations in EF Core
Altering EF Core migrations execution order
28
Nov
2021
Unit of work pattern with Dapper
Implementing unit of work pattern with Dapper in .NET 5
21
Sep
2021
Adding display name to Enum values
Implementing additional values for Enum items in C#
JavaScript
28
Oct
2018
HTML5 localStorage with expiry with vanilla JavaScript
Using HTML5 localStorage with expiry
8
May
2018
Monitoring DOM changes with JavaScript
Handling DOM changes with plain JavaScript
9
May
2017
Non blocking CSS load on the page
Load external CSS files in an async manner
16
Mar
2017
Serialize html form to JSON without using JQuery
Transform user input from HTML form fields to JSON
17
Jan
2016
Copy text value to clipboard using jQuery
Simple sample of using jQuery to copy value to clipboard
11
Jan
2016
Resize image on the client side with JQuery
Reducing the upload sie by resizing image on the client side
SQL/T-SQL
22
Feb
2022
Select column names with values from SQL Server database
Fetching column names with its value in T-SQL using built in JSON methods
23
May
2020
Identifying opened connections for the specific application in SQL Server
Connection listing queries in SQL Server
3
May
2018
Reading JSON data in T-SQL on SQL Server
Extracting values from JSON string on SQL Server using T-SQL
28
Apr
2016
Create XML/HTML with T-SQL
Generating XML/HTML output in SQL Server
24
Nov
2015
IP address to octets split in TSQL
Split IP addresse into octets in SQL Server
20
Jul
2015
Getting first and last second of the current year, month and day
Using minimum and maximum date time in SQL query
Umbraco CMS
2
Mar
2018
Minify HTML output of your pages
Minification of HTML output using ASP.NET IHttpModule
18
Apr
2015
Generate sitemap.xml on the fly in Umbraco CMS
Simple sitemap.xml Umbraco handler
2
Mar
2015
Accessing UmbracoHelper in HttpHandler request
Working with UmbracoHelper and IPublishedContent in HttpHandler
14
Sep
2014
Same page language switching in Umbraco
Land on the same page in different language in Umbraco using Relations
4
Sep
2014
Getting cropped image the smart way
The way to get cropped image URL with option to load original image too
27
Aug
2014
Fastest way to return JSON result from a controller
Resturn JSON in MVC controller action