Skip to main content

Posts

Custom SPA engine, similar to MVC pattern by using TypeScript

Single Page Application, a fundamental requirement for SPA is to develop the application with XMLHttpRequest (XHR) or AJAX. That is only main requirement, other things come as add-on stuff.
Advancements of SPA? In today's world, we do not want to be restricted with basic features or functionalities. We want everything like any new Phone comes in market with some new shiny feature. There are a lot of functionalities available with SPA libraries and could be extended with more extension to have richer and easier implementation. To be specific we shall refer it as frameworks, not libraries.

Earlier days one-way, two-way data binding with templates were very minimum things to expect from frameworks. Now they talk about component structure, Virtual Dom, IOC, state management, performance etc.
Why building own framework/library? What I believe and experienced is each SPA JS Frameworks has its own set of rules and structure that has to be followed. If we want to have our own dynamic thi…
Recent posts

Fluent mapping approach for EF Core

With the first release of EF Core, there wasn't any proper approach of fluent mapping of entities, in an easy manner for enterprises application where a lot of entities needs to be involved. You might have ended up with nasty or repeated codes.

At that time only way was to compose mapping based on ModelBuilder and by using inline fluent mapping codes. Like in newer version EF Core 2.0 there had been a new release of IEntityTypeConfiguration for the creation of mapping based on single entity and could be registered with ApplyConfiguration by passing a new instance of IEntityTypeConfiguration object.https://docs.microsoft.com/en-us/ef/core/what-is-new (Self-contained type configuration for code first)
This is really good for big application as we can separate mappings based on each entity.

In this article, we would see how to achieve similar functionality in EF Core 1.0 and this implementation is a bit cleaner than 2.0 built-in classes. So, in both of versions, this could be used w…

jQuery Datatable generic implementation on .Net/dotnet Core for any entity server filtering or sorting through EF/EF Core

jQuery Datatable is one of the popular freely available grid for the developers. It works really great on the client side but there is always need to write a lot of codes on the server side for filtering and sorting for each individual entities.

In this article, we would address this by creating a generic implementation of server code which can work on any entity without writing any further piece of code for filtering and sorting. Just by calling a generic extension method it would resolve sorting and filtering.

The key points to achieve it are as follows:
- Model binding and provider to transform client side request to strongly typed item on the server.
- Once we get strongly typed items to read values, we can apply a dynamic approach to generate queries and filters through LINQ expression.
- At final part, just consumption of created mechanism by creating endpoints for each entity. Also, we can easily select required columns through LINQ projection.
Model Binding As per DataTable ser…

Efficient custom mapping from data model to ViewModel/Dto or vice versa with LINQ support

How many lines of codes we waste on mapping from one source to a destination like DataModel to ViewModel.  There are well-known Mappers available to do the same but nothing can come close in terms of performance by using manual mapping just that we need to write at too many places or takes a huge chunk of code lines in our main codes, may be under controllers, services or where ever you prefer projection in code.

The idea is to develop a proper way to deal with mappings. Some time back I had written code for manual mapping under LINQ queries. Manual model mapping - LINQ projection technique, this still works great. The idea is to create a cleaner solution as a whole new package for handling Mapping which can support general mappings between models and support of LINQ projection to select the limited number of rows as required.

Primary objectives of the implementation.
- A Data model to view model/DTO/or any other.
- view model/DTO/or any other to a data model.
- Support of LINQ proje…