-1

I am trying to set up a database first project to handle the data access for a database that is common to several applications that use. The value of these properties will be set differently based on the method called, who is calling, etc. Is there any way to set a property that has a get and set method that EF will not try to map to a database field?

Chad
  • 1,512
  • 1
  • 16
  • 40
  • I would think that a ViewModel would be the best way to accomplish this. Is there a particular reason you are not going this route? – ghg565 Jul 01 '16 at 16:10

1 Answers1

4

Use the [NotMapped] Attribute.

public class MappedClass
{
    public string MappedProperty { get; set; }
    [NotMapped]
    public string NotMappedProperty { get; set; }
}

Reference MSDN

giammin
  • 18,620
  • 8
  • 71
  • 89