Getting Started with Entity Framework Core

In this article you will learn about new lightweight version of entity framework that is entity framework core . If you have entity framework experience , you may be aware that EF core has been written from scratch to achieve some new goals. Here you will learn about similarities and differences from EF 6.

So What is Entity Framework ?

Entity framework is the set of .net APIs for performing data access in your software  and entity framework  is official data access tooling  from Microsoft .

It originated from Microsoft research and  then it was adopted from team who was responsible for ADO.Net as the next generation of Microsoft’s data access technology .

EF has gone through number of major revolution with most of new capabilities being added on top of what was built into the .net framework.With EF6 ,Entity framework was moved to codeplex and became open source and since then it moved to github and remains quite active.

Entity framework fits into a category of data access technologies called Object Relational Mappers (ORM). ORMs are designed to reduce the friction between how data is structured in relational database and how you define your classes ,without ORM we have to transform lot of code to transform database results into instance of our classes inn our software .

An ORM allows us to express our queries using our classes and then ORM builds and executes relevant SQL for us,but Entity framework is different from any ORM you might be familiar with.

While a typical ORM infers that the classes and database tables are of  a similar structure,Entity framework has a mapping layer in between and gives us a lot more flexibility in to how to get from objects to table and from object properties to table columns and for these mapping entity framework does start with some assumptions and we refer to those as  conventions but then you can apply additional mappings rules on top of conventions to be sure that in your specific scenario that the data is able to find its way back and forth between your objects and your database.


Why Entity Framework ??

EF Core Advantages

Using an ORM can really eliminate a  slew of redundant data interaction tasks and doing so EF can enhance developer productivity.

Rather than writing relevant SQL to target whatever relational  database you work with , EF uses the LINQ syntax that’s part of  the .net framework. LINQ to entities allows developer to use consistent and strongly typed query language regardless of which database they are targeting additionally LINQ for objects is used for querying other elements of .net.

Using ORM allows developers to focus on their domain , their business rules and their business objects .They don’t have to worry about direct interaction with the database or being  intimately familiar with the databse schema.

What is Entity FrameWork Core ?

EF core was released in late June 2016 . Entity Framework Core is lightweight and extensible version of popular Entity Framework data access technology .This is not simply an update from EF6, its  a different kind of entity framework. Like EF6, EF core is open source and available on GitHub.

Where can you Use EF Core ?

Entity Frame work core runs on .NET core and .NET core runs in lot of places :
  • .NET 4.5.1+
  • .NET Core
  • UWP Universal Windows Platform for Windows 10 that runs o any device.
If you are targeting cross platform or  UWP you have to use EF Core.

EF6 features not coming to EF Core

  • No EDMX /Designer in EF Core
  • ObjectContext API
  • Entity SQL
  • Metadata Workspace API
  • Overly complex mapping
  • MEST* mapping

How EF Core Works?

EF Working

  • First you need your domain classes ,this part actually has nothing to do with EF,this is just defining your class.
  • Then you use EF APIs to define a data model based on those domain classes .You also use EF APIs to write and execute LINQ to entities Queries against those classes ,and in your code you need to call entity framework save changes to push back data to the database.
  • EF APIs keep track of the state of object that it’s aware ,it will determine the SQL it needs to save back to the database, and for queries ,EF will transform your LINQ to Entities Queries into SQL ,execute that SQL and then create objects from query results.
  • EF Manages all of the interaction with the data store .

Some developers are starting a new project from the scratch and will most likely start by planning how the domain will function and that will help them define the classes then they can code the classes and when it’s time to add in the data persistence you can then  create DbContext classes to define data models that wrap those domain classes , the data model can then be used as entity framework migrations to create and evolve the database.

But often we already have a  existing database  and while those database tables and views and stored procedure may not reflect what your domain classes should look like they do provide a good head start.

And its possible with EF core to start by reverse engineering one or more tables into DbContext class that is your data model and a set of domain classes and that uses  Scaffolding feature.


Mapping Classes & properties to data-base

When defining the data model, your classes aren’t required to exactly match the schema of the database , EF has default rules for how it will infer what database schema looks like.

Basic Work flow

EF WorkFlow

Starts with domain classes , you can then use EF DbContext API to wrap the classes into a model and instruct EF as to how those classes in the model map to database schema.EF then can translate queries that you write and LINQ to Enities against your classes into SQL that is understood by your database  , and then executes tour queery and uses the result t return populated instances of your objects.


EF Core Enables Long Requested Features that were not in EF 6:

  • Ability to do batch inserts, updates ,and deletes , that’s something that’s never been supported in EF.
  • Able to specify unique foreign keys In entities .
  • LINQ Queries have become smarter .
  • Easy to work with entities and graphs in disconnected applications as well as to provide much more consistent behavior.
  • In-Memory provider for testing that don’t need to hit the database.
  • Mapping to backing fields and IEnumerable.

You can get more related information on gitHub through this link

Happy Coding !!

Firebase Complete Guide for Xamarin


Firebase is part of a growing trend known as “Back end as a service”. Traditionally configuration of a server would require you to fetch data via some API you have written in order to retrieve data from your server.  When using SQL, you would have to write code that stores objects and properties that can be accessed in your code.

A cloud-hosted NoSQL database. Data is stored as JSON, synced across connected devices in milliseconds, and available when your app goes offline. Intuitive and easy-to-use API. Remains responsive regardless of network latency or Internet connectivity so apps works offline.

What is amazing about Firebase, is that essentially with one line of code, you are ready to begin writing to your database instantly. This gets stored as JSON (JavaScript Object Notation) and can be read and used in your application nearly as easily.

Firebase expedites the storing and retrieving of data via a third party service and comes with its own API so you don’t have to write one.


Continue reading “Firebase Complete Guide for Xamarin”

Enabling SSL with IIS Express in Visual Studio Express

Enabling SSL with IIS Express in Visual Studio 2015

  • Select the startup project and press F4 (the function key) this will open the property window.
  • To enable the SSL with in IIS Express, you have to just set “SSL Enabled = true” in the project properties.
  • Once you change the value, Visual Studio set in automatic the SSL URL, e.g., https://localhost:44301/.
  • Copy SSL URL. Go to the Advance properties by pressing Alt+Enter, select the Web tab and set the Project URL with the same value of SSL URL, e.g., https://localhost:44301/.
  • Now you have configured the default URL of the web application, we can run the site (F5 or CTRL + F5).PS: The first time you set the secure protocol on IIS Express, you will be prompted to install the certificate for SSL.

    Enabling SSL

    If you are getting “IIS Error: cannot add duplicate collection entry of type ‘mimeMap’ with unique key attribute ‘fileExtension

    Please refer this .

Hope this will help !!

Store data in WCF Operation Context.Is ThreadStatic safe?


WCF infrastructure allows you to store context sensitive data in InstanceContext of the service instance similarly like we do in HttpContext of MVC. For that you should implement from IExtension and plug that class into WCF’s infrastructure.

public class WcfOperationContext : IExtension<OperationContext>
    private readonly IDictionary<string, object> items;

    private WcfOperationContext()
        items = new Dictionary<string, object>();

    public IDictionary<string, object> Items
        get { return items; }

    public static WcfOperationContext Current
            WcfOperationContext context = OperationContext.Current.Extensions.Find<WcfOperationContext>();
            if (context == null)
                context = new WcfOperationContext();
            return context;

    public void Attach(OperationContext owner) { }
    public void Detach(OperationContext owner) { }

Which you could use like that:
WcfOperationContext.Current.Items["data"] = "My Data";
string user = WcfOperationContext.Current.Items["data"] as string;

 Continue reading "Store data in WCF Operation Context.Is ThreadStatic safe?" 

Basic Fundamentals of AngularJS

In this article we will understand the basic fundamentals of AngularJS.

What is AngularJS?

  • Angular is JavaScript library.
  • It is a MV* framework, where MV * means:

M- Model : where you store data and state of application.

V- View   :  which actually renders to user the information they want to see.

* : Controller /Presenter/View-model

Features of AngularJS 

  • It is an open source library.
  • It is comprehensive which means it handles AJAX communication with your server so that you can send and receive data from back-end.This data is stored as plain JavaScript object.
  • It supports two way binding, which  means that the user input from fields is instantly updated in angular models.
  • AngularJS also employees technique called Dirty Checking which means that you don’t have to put data in special structures and call getter and setter methods to read and write to your data . You can simply put data in plain old JavaScript object and Angular will respond  whenever your data changes and update your view.
  • AngularJS is built on Dependency Injection.This lets you encapsulate pieces of your application better and also improves test ability.
  • AngularJS also handles routing for moving from one view to another .This is the key piece in building Single Page Application or SPA.
  • AngularJS not only supports unit test but also integrates end to end testing.

Directives :

AngularJS extends HTML by providing its own elements and properties called Directives.These are used to interact with your HTML DOM. It teaches your HTML new tricks.It is an extended HTML vocabulary.

Angular Components:

Everything starts with controller, it is a central player.screenshot-from-2016-09-17-011954

Continue reading “Basic Fundamentals of AngularJS”

Basic Git Hub Usage Manual

Git Hub Usage Manual

GitHub Account Creation And Setup Configuration:

  1. Need to create an account on with official email id. And also activate two factor authentication and set profile picture over there. Once done with these inform Jaco about it, so he can add you in the CeX organization account.
  2. Now create the Personal Access Token from the Settings, it will be useful when we want to push the changes to the remote through Git Bash.
  3. Download GitHub Desktop from and Git from and install these two applications.
  4. When you start GitHub desktop, you have to login over there. To login on GitHub Desktop goto Tools And Options and then in Options you will find the add account option.
  5. For Git open Git Bash and run $ git config –global “<EmailID>” command, this will configure your account in Git.

Git vs GitHub

Continue reading “Basic Git Hub Usage Manual”

How to Configure Samba Server on CentOs 7

Configure Samba Server on  CentOs 7

This article will be a quick guide to show you guys how to setup a network share with Samba on CentOs 7 or any other similar Linux distribution like Red Hat.

Samba share allows sharing of files between the server and various different computers on the same network.

Note: The following commands will require super user privileges.

1. Install Samba: Although Samba should come preinstalled on Centos but you can install it or check if it’s installed   using the command

sudo yum install samba


Samba 1 (2)

2. Start services smb and nmb: 
                        sudo service smb start && sudo service nmb start

You can now check the status of these services by typing the command

sudo service smb status

Samba 2 (2)

If everything is fine you will get an output like this.

3.  Loading the services on login: We want these services to be loaded with the default multiuser runlevel, we      want these services to be running when we login.

We first check if they are already enabled

sudo systemctl list-unit-files | grep smb

The service can be enabled using command

sudo chkconfig smb on && sudo chkconfig smb on

4. Create a directory to be shared: This will be the directory that will be shared.
         sudo mkdir  /home/<user_name>/<folder_name>

5. Modify the permissions of the new directory: This will ensure that the directory is readable, writable and executable.
               sudo  chmod  –R  777  /home/<user_name>/<folder_name>
               sudo  chcon  -R  -t  samba_share_t  /home/<user_name>/<folder_name>

6. Set a password for your user in samba: <user_name> is the name you used to login to your CentOs server. Remember this will be the username and password that you will use to access the samba share.

sudo smbpasswd  -a  <user_name>

7. Edit the file “/etc/samba/smb.conf”:
          sudo nano /etc/samba/smb.conf

Samba 3 (2)

Add the following details at the end of the file
path = /home/<user_name>/<folder_name>
         browsable = yes
         guest ok = no
         valid users= user_name
         writable = yes

Samba 4 (2)
8. Allow samba through the firewall:
       sudo firewall-cmd  –permanent  –zone=public  –add-service=samba
       sudo firewall-cmd  –reload

Samba 5


How to use String.Format to get multiple value from radio button?

For getting more than one value let us say “ID” and “Contact” from single radio button on change event you have to write code like :

<input type=”radio” class=”radio” name=”RadioButton” value=’@String.Format(“{0}|{1}”,ID,Contact />

Now for getting these value using jquery :


$(“input[name=RadioButton]:radio”).change(function () {

var arm = $(this).val();

var arr = arm.split(‘|’);

var ID = arr[0];

var Contact = arr[1];



Happy Coding!!.


Jquery .live() running twice ?

This  happens when you click the same element again and again ,to rectify this situation just add .die before it .

$(selector).die(‘click’).live(‘click’, function () {


Happy Coding !!!!


The located assembly’s manifest definition does not match the assembly reference

Looking for the solution. Yes you are at the right place. Once I also faced the same issue when I was working on a MVC project, I got the error states that “The located assembly’s manifest definition does not match the assembly reference” .


When I ran the solution I saw the YSD (yellow screen of death) that simply gave me the assembly name which is causing the issue.

Could not load file or assembly ‘System.Web.Optimization, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35’ or one of its dependencies. The located assembly’s manifest definition does not match the assembly reference. HRESULT: 0x80131040

In my case I have several MVC projects referring to “System.Web.Optimization” , but I’m getting this issue only in newly added project. When I investigated the issue I found that the project referring to the higher version of “System.Web.Optimization”. This is because the dll has been included using nuget and nuget always downloads the latest version of dll.

FYI:  The Microsoft.Web.Optimization package is now obsolete. With ASP.NET (MVC) 4 and higher you should install the Microsoft ASP.NET Web Optimization Framework.

Continue reading “The located assembly’s manifest definition does not match the assembly reference”