What is IOC Container

IOC Container is a mechanism to achieve dependency injection to make our classes loosely coupled.

We can achieve inversion of control using 2 ways-
1. Dependency injection pattern
2. Service Locator pattern

There are many IOC Container available in .Net,some of mostly used are as given below…

  1. Castle Windsor
  2. Ninject
  3. Autofac
  4. Unity

How to debug/print Line no on live on IIS in Published code in .Net

When you publish your code in release mode on Server and you want to print a line number.You have to follow following steps to achieve this

Step-1 Right click You Project > Property > Package/Publish Web> Uncheck Exclude generated Debug Symbol

Step-2
Save and publish you code You will see PDB file will be generated over there which will track you published code Error.

IEnumerable and IQueryable Interface in C #

IEnumerable<T> Interface in C #

IEnumerable interface is a simple iteration over a collection of a specified type.It has Method GetEnumerator() that iterates through the collection.
Use: Mainly used to work with in memory data i.e List,Array
Example: IEnumerable<Product> products = db.employee.Take(3);

IQueryable Interface in C #

It is basically used to evaluate queries against a specific data source.
Use: Used to query database.e.g. iin LINQ
Example: IQueryable<Product> products = db.employee.Take(3);

Difference:

In IEnumerable All employees will be loaded After Loading all data program will filter
Query run on database- Select * from Employees
In IQueryable Data will be filterd on Database Program will get only top 3 recoreds
Query run on database- Select TOP 3 * from Employees