Reputation: 2823
so i have this model class:
[Table("items")]
public class items
{
public int id { get; set; }
public string text { get; set; }
public string value { get; set; }
// public int test { get; set; } crashes
}
I use entity framework. my table has id,text,value
and test
property is not part of it. I populate my DbSet
like this
public DbSet<items> items { get; set; }
Odd enough, it doesn't crash if i add something like public List<string> test { get; set; }
.
What should i do? i originally wanted to add a bool?
property.
edit: I was thinking of making a new class that will inherit the model, but i will have to remap/re-populate it.
Upvotes: 4
Views: 1478
Reputation: 14308
You can add the NotMapped
attribute.
For example:
[Table("items")]
public class items
{
public int id { get; set; }
public string text { get; set; }
public string value { get; set; }
[NotMapped]
public int test { get; set; }
}
Upvotes: 5