Tips & Tricks on ASP.NET MVC, Ajax, jQuery, Entity Framework

Entries for the ‘EntityFramework’ Category

Column Attribute in Entity Framework 5

When developing applications using Entity Framework code first approach, you may use Column data annotation on your model properties to define what attributes that property has, ex : name, type etc. in Entity Framework 4.3.1,  ColumnAttribute is defined in System.ComponentModel.DataAnnotations namespace which is available in EntityFramework.dll. So you need to add a reference to EntityFramework.dll and include a using [...]

Foreign Key relationship in Entity Framework Code First

This is the third part of my Entity Framework Code First Tutorial for beginners. If you want to start fresh , Visit the first part here. Entity Framework Code First has some nice conventions to follow when you want to work with relationships.  Let’s see how it works. If your class contains a reference and a collection nvigation [...]

Entity Framework Code First Inheritance : Table Per Type and Table Per Hierarchy

Recently i answered a question in stackoverflow about how to create separate tables for each sub type when handling inheritance. Today i thought of expanding it with some sample source code and share it here. While working with data driven applications, Some times we need to implement Inheritance in our code as well as the data storage. Let’s take a look [...]

Starting Entity Framework Codefirst Approach Part- 2

This is the second part of my Entity Framework Codefirst  Tutorial for beginners. If you want to start fresh , Visit the first part here. If you tried the first part, while creating the database using code first approach, you might have noticed that our columns of string type is created as nullable columns of type [...]