Category Archives: CSharp

ELMAH Error Logging in MVC 4

ELMAH (Error Logging Modules and Handlers) is an application-wide error logging facility that is completely pluggable. It can be dynamically added to a running ASP.NET web application, or even all ASP.NET web applications on a machine, without any need for … Continue reading

Posted in CSharp, MVC, Visual Studio 2012 | Tagged , , , , , , , , | Leave a comment

Dependency Injection in MVC 4 using Ninject, Unity and StructureMap (IoCs)

Dependency injection is a software design pattern that allows removing hard-coded dependencies and making it possible to change them. This software design pattern injects the depended-on element (object or value etc) to the destination automatically by knowing the requirement of … Continue reading

Posted in CSharp, MVC, Visual Studio 2012 | Tagged , , , , , , , , , , | 3 Comments

Entity Framework Code First Example in MVC 4.

This example will show you how to create a MVC 4 application using Entity Framework Code First in Visual Studio 2012. 1. Create a new Project MVC 4 Internet template. Name: MVCMovieTraining. 2. In the Models folder add new class. Name: … Continue reading

Posted in CSharp, Entity Framework, MVC, Visual Studio 2012 | Tagged , , , , , , , , | 1 Comment

Repository Pattern

Use a Repository to separate logic that retrieves data from the business logic. It is an abstraction between data access and business logic. The following example is based on the project in the post Entity Framework Code-First example in MVC 4, in … Continue reading

Posted in CSharp, Entity Framework, MVC, Visual Studio 2012 | Tagged , , , , , | 1 Comment

Generic Collections in C#: List, Dictionary, Stack and Queue

The System.Collections.Generic namespace contains interfaces and classes that define generic collections, which allow users to create strongly typed collections that provide better type safety and performance than non-generic strongly typed collections. Dictionary<TKey, TValue> Represents a collection of keys and values. … Continue reading

Posted in CSharp, Generics, Visual Studio 2012 | Tagged , , , , , , , | Leave a comment