0

I am using code first approach in Entity Framework. I have a poco class that I want to map on a database but I use the same class to bind the data to my UI hence it contains some extra attributes. I want to map some attributes of the class to database but not all of them but I am unable to do that! Any solution

When the class attributes are equal to table column it works completely fine

  • 1
    Welcome to SO! You should go ahead and read ["How to ask a question?"](http://stackoverflow.com/help/how-to-ask) which will help you improve your question. – Yuval Itzchakov Jan 15 '15 at 07:50

1 Answers1

0

You should use NotMapped attribute:

public class Entity
{
    public int Id {get; set;} 

    [NotMapped]
    public string NotMapped {get;set;}
}
Vsevolod Goloviznin
  • 12,074
  • 1
  • 49
  • 50