Reputation: 645
I'm trying to define a field that's not in my database. Its form is like this:
public string Adress {get;set;}
public int? Number {get;set;}
public string Name {get{
return (this.Adress + " " + this.Number.ToString())
} set{}}
...and when I run the Index (whose model is of type IEnumerable), the controller throws...
Invalid column name 'Name'.
I want to do this so I don't have to concatenate all these every time.
I'm using ASP.NET MVC3 and SQL Server 2008.
Is there a way to tell the model I don't have a column with that name?
Upvotes: 0
Views: 83
Reputation: 645
I discovered how to do this.
It can be managed by using the [NotMapped] property.
Upvotes: 1