Adding Angular Material in ASP.NET Core Angular SPA template (Bonus : Animations)

If you are not familiar with ASP.NET Core SpaServices, take a look at this repository: https://github.com/aspnet/JavaScriptServices/tree/dev/src/Microsoft.AspNetCore.SpaServices Lots of SPA templates (Angular, React, Vue, Aurelia etc.) are available in this repo that uses NodeServices for server side rendering. We will work with the AngularSpa template and add Angular Material in it. To install the Spa templates via yeoman, first intall the template generator with the following command: npm install -g generator-aspnetcore-spa@next Create a directory where you will initialize the…

Keep reading

Execute javascript code from ASP.NET Core back-end using NodeServices

Not many are familiar with this awesome feature of dotnet core. Aspnet team is actively maintaining a project named JavascriptServices; Along with other packages, it includes the NodeServices package. Using this package, one can easily create an instance of node and execute javascript code (function) in the backend. If you think of it right now, you can see that it actually opens up a wide variety of development opportunities. By opportunities I mean; the asp.net core project is trying hard to make its package eco-system (NuGet) rich but while…

Keep reading

Enable Entity Framework Core (1.1.1) Migrations From Separate Assembly

Watch the video if you don't like reading: So, today I tried updating all my project packages to dotnet core 1.1.1. Everything went pretty well except the EF Core's 1.1.1 update. Like everyone else I like putting my DbContext and Repository files in a seperate assembly. A barebone DbContext class may look like this: public class ApplicationDbContext : DbContext { public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) : base(options) { } } Up until 1.1.0 I was able to run migrations. But today when I tried to add a…

Keep reading

Smart Technical Debt Estimation with NDepend

It’s been less than a year since I last wrote a blog about NDepend. And here again, I’m writing about an awesome static analysis tool that everyone likes. I must confess that I had no idea on static analysis and analyzer before having an encounter with NDepend. Only after going through NDepend, have convinced me that this type of tool can really make our developing/managing life plain, simple and easy. However, in the middle of the last year I was totally converted to a guy who now…

Keep reading

Implementing Common Audit Fields with EF Core’s Shadow Property

One of the coolest feature of EF Core is, you can define properties that don’t exists in the Entity class. They are called shadow properties. While working on EF6, I needed some common audit fields that every entity will extend. Like, when a row of a table is updated, when a row is created, what is the row version etc. Since there was no concept of shadow properties in EF6, what I and many other developers did is create an interface with those common fields and implement that interface…

Keep reading

Building Custom Formatters for .Net Core (Yaml Formatters)

Quite recently I got myself introduced to .net core’s formatters. In short, what formatters do is format your response and request in your preferred data formats. For example, Json formatters, if used would format your response (returned value from controller's action) and request (value passed as a parameter to the controller) in Json. Same goes for the XML and other formatters. .Net Core gives you some formatters out of the box. This official documentation link described them briefly https://docs.microsoft.com/en-us/aspnet/core/mvc/models/formatting But…

Keep reading

Dependency Injection to The Core (Part - III)

We came to know about the term IoC container. There are many IoC containers available and most of them do the same things somewhat differently. Let’s use one of them in our current project. Let’s pick Autofac which has a great documentation online. Here is the link where you can know all about the Autofac integration related stuff with Web API projects, http://autofac.readthedocs.io/en/latest/integration/webapi.html Since we are just beginners wondering around the world of dependency injection. We will go slow and…

Keep reading

Dependency Injection to The Core (Part - II)

Say for example, our client changed their requirements and now wants us to read and write comma separated data (CSV) from a filesystem instead of a database. Suppose I’ve searched and downloaded a cool library that can work with CSV files. So, we have a CSV library configured and ready to talk with our CSV files in the data access layer. If you are following me then you would say, now that we have a new data access layer, we also need a new repository. Right? Exactly! Since we…

Keep reading

Dependency Injection to The Core (Part - I)

Okay since I’m writing blogs mostly on asp.net core lately, you might be wondering that why am I writing a blog on a topic which is already available in asp.net core official documentation. Well, in this post I’m not only going to talk about how you can achieve DI (Dependency Injection) in .net core but will also discuss about DI itself (what, why and how). This article reflects how I actually learned (still learning) DI. So, if you don’t want to follow my approach or…

Keep reading

Don't Share Your Secrets! (.NET CORE Secret Manager Tool)

I’ve been working on this million-dollar project of mine and wanted it to make the project open source. So, I made a repository on github and pushed my project. That’s where I almost made a big mistake. Since my project was data driven so there were some connection strings stuff in my web.config file, Practically I would remove the connection strings and other credentials stuff out of my web.config file before I push it to the repository. But it was a big headache for me since…

Keep reading