Simplifying the JavaScript Callback function for .NET developers

In JavaScript, functions are objects, and they can:

  • Be passed as an argument to another function
  • Return as a value from a function
  • Be assigned to a variable

Let’s assume that you have a JavaScript function (let’s call it function A) with the following properties:

  • Function A takes another function (let’s call this one function CB) as one of the parameters.
  • Function A executes the function CB in its body

In the above scenario, function CB is known as the Callback function. Let’s learn more about it using the following code:

Read full article on the Infragistics blog

Objects in JavaScript for .NET developers – Part 1

Read full article on the Infragistics blog

Here are some fun facts for you: JavaScript is not an object oriented language, but almost everything in JavaScript is an object. JavaScript does not have classes, and we can create an object from an object. A function can be used as a constructor, and returns a newly created object. Every object in JavaScript contains a second object called a prototype object.

If you’re coming from a .NET background, the sentences you just read probably don’t make any sense. But these are all true statements about JavaScript. And in this post we will focus on different ways to create objects in JavaScript

  1. Object as literal
  2. Creating an object using the new operator and constructors
  3. Creating an object using the Object.create() static method
Object creation as literal

The simplest way to create an object is by creating an object using the object literal. We can create a simple object as shown in the listing below:

Read full article on the Infragistics blog

How to use AngularJS in ASP.NET MVC and Entity Framework

Read full article on the Infragistics blog

These days, it seems like everyone is talking about AngularJS and ASP.NET MVC. So in this post we will learn how to combine the best of both worlds and use the goodness of AngularJS in ASP.NET MVC by demonstrating how to use AngularJS in an ASP.NET MVC application. Later in the post, we will see how to access data using the Entity Framework database as a first approach, then we’ll explore how to access the data in AngularJS and then pass to the view using the controller. In short, this post will touch upon:

  • adding an AngularJS library in ASP.NET MVC;
  • · reference of AngularJS, bundling and minification;
  • · fetching data using the Entity Framework database;
  • · returning JSON data from an ASP.NET controller;
  • · consuming JSON data in an AngularJS service;
  • · using AngularJS service in AngularJS controller to pass data to the view; and
  • · rendering data on an AngularJS View

To start, let’s create ASP.NET MVC application and right click on the MVC project. From the context menu, click on Manage Nuget Package. Search for the AngularJS package and install into the project.

Read full article on the Infragistics blog

How to share data between controllers in AngularJS


In my AngularJS classes, I often get asked, “How do I share data between the controllers in AngularJS?” On the Internet, there are many solutions suggested. However, I prefer to share data using the Shared Data Service method, and that’s what we’re going to explore in this post.

To start with, let’s suppose that we want to share a Product object between the controllers. Here I have created an AngularJS service named SharedDataService as shown in the snippet below:

Read full article on the Infragistics blog

Resources from workshop on Onion Architecture in ASP.NET MVC

Find resource from the workshop here

I would start this post thanking students who came to learn in almost 40 + degree centigrade, thanks to C# Corner Delhi Chapter for hosting it, and thank to Infragistics for supporting it. I had awesome time teaching onion architecture in ASP.NET MVC.


I love to teach and perusing my love of teaching on Saturday 2nd May I delivered a workshop on Onion Architecture in ASP.NET MVC. It was attended by around 50 people and we had good discussion around

  • Repository pattern
  • Inversion of control
  • Dependency injection
  • Onion architecture
  • Unit Testing
  • MVC application etc.

Find resource from the workshop here


Find resource from the workshop here

I am excited to see you soon in next workshop. Till then happy coding.