Menu
C# Unit test a Repository class using a Seeded InMemoryDatabase

C# Unit test a Repository class using a Seeded InMemoryDatabase

If you wanted to unit test a Repository that uses a DbContext with seeded data, you can use the InMemoryDatabase.

Unit testing Basic Authentication Handler in asp.net core (C# )

Unit testing Basic Authentication Handler in asp.net core (C# )

Unit testing Basic Authentication Handler in asp.net core (C# ), I will be using the Xunit (my preferred) and Moq, I personally prefer NSubstitute, but the project was already using Moq and I didn’t want to change it.

Using OData paginated payload with ngx-bootstrap Pagination component

Using OData paginated payload with ngx-bootstrap Pagination component

All the OData endpoints have stranded responses, I don’t want to change it. Now I need to do my Angular implementation to support OData stranded.

Creating a Model for an Existing Adventure Works Database in Entity Framework Core

Creating a Model for an Existing Adventure Works Database in Entity Framework Core

Recently I started playing around with Odata and wanted to fast track development with an existing database. I don’t want to waste time on data and the database structure, rather I spend time on asp.net core oData.

C# – Unit testing a AutoMapper Profile mappings

C# – Unit testing a AutoMapper Profile mappings

When you use AutoMapper to map our objects, and AutoMapper profiles are the way we do it, it encapsulates a lot of business logic in some cases. But we need to make sure the business logic gets unit tested.

C# – Unit testing a Mediator handler that has AutoMapper Profile

C# – Unit testing a Mediator handler that has AutoMapper Profile

As part of my Mediator handler, I have multiple dependencies injected they are DbContext, IMapper. But remember, as part of the application initialisation we have AutoMapper Profile registration automatically. But it’s not the case with Unit Testing we need to register the dependencies or mock them. Therefore we need to add the Profile to our IMapper initialisation.

Asp.net Cache Core – using in memory cache

Asp.net Cache Core – using in memory cache

Most of the apps we write have some data that not get updated frequently or not get updated at all. For example – suburb list, user roles, etc. We can avoid reading the database for all those entities by using a cached collection.

Entity Framework Core (EF Core) group daily data to monthly

Entity Framework Core (EF Core) group daily data to monthly

I had to create a chart from Chart JS to display, displaying data with Chart JS is super easy, but getting the data from the server is bit tricky unless you are a SQL expert (well not me :)). Below query will group it by month.

Asp.net core 2.0 and Entity framework Core – registering DbContext with ServiceLifetime.Transient

Asp.net core 2.0 and Entity framework Core – registering DbContext with ServiceLifetime.Transient

Registering the DbContext in order to use it throughout the application as ServiceLifetime.Transient

Creating quick suburbs look up using ASP.NET Core web API and Angular 2 – part 2

Creating quick suburbs look up using ASP.NET Core web API and Angular 2 – part 2

In this tutorial I will be building a Australian suburb look up module using ASP.NET Core web API, as the second part I will create the client side, using Angular 2

Creating quick suburbs look up using ASP.NET Core web API and Angular 2 – part 1

Creating quick suburbs look up using ASP.NET Core web API and Angular 2 – part 1

In this tutorial I will be building a Australian suburb look up module using ASP.NET Core web API, as the first part I will create the server side.

Using Sqlite in ASP.NET Core

Using Sqlite in ASP.NET Core

Using Sqlite in your asp.net core application

Server side pagination in ASP.NET controler that supports any entity

Server side pagination in ASP.NET controler that supports any entity

Pagination on server side is a very common scenario. So thought about creating helper.

Using .NET Core CLI for Entity framework migrations

Using .NET Core CLI for Entity framework migrations

You can refer to full list of commands here. Documenting this for my own reference especially as my mind goes blank sometimes

Advance auditing – audit every entity using EntityFramework-Plus

Advance auditing – audit every entity using EntityFramework-Plus

Auditing every changed field using the EntityFramework-Plus

Simple audit using Override Entity Framework SaveChanges()

Simple audit using Override Entity Framework SaveChanges()

Overriding Entity Framework SaveChanges() method so you can populate the entity ModifiedBy,ModifiedOn, CreatedBy, CreatedOn properties

Entity Framework Core extensions remove pluralisation of table name

Entity Framework Core extensions remove pluralisation of table name

Writing an extension for removing pluralisation of table names in Entity Framework Core extensions.

Configuring the AutoMapper property binding behaviour

Configuring the AutoMapper property binding behaviour

You will have to change the way the properties get mapped most of the time, as it not always one-to-one.

Entity Framework Core extension to Execute Stored procedure and get results back

Entity Framework Core extension to Execute Stored procedure and get results back

Since Entity Framework Core is fairly new (at the time I am writing) and still under development. Not most of the required features are not there out of the box and you will have to write extensions. I have to utilise an existing stored procedure to get some data from database. I have to use ADO […]

Entity Framework Core setting default database schema

Entity Framework Core setting default database schema

Entity Framework Core setting default database schema for your code first tables and migration history tables

Migrations and Seeding on ASP.NET Core

Migrations and Seeding on ASP.NET Core

Migrations and Seeding on ASP.NET Core