Answer the question
In order to leave comments, you need to log in
How to create a property that does not need to be stored in the database with the model first approach?
There is a book class generated by model first:
public partial class Book
{
public int Id { get; set; }
public string Name { get; set; }
public string Author { get; set; }
public int Year { get; set; }
public string Publishing { get; set; }
public string Discription { get; set; }
public string Genre { get; set; }
public int Count { get; set; }
}
public int AvailableCount {
get
{
// Логика..
int someInt = 12;
return someInt;
}
}
Answer the question
In order to leave comments, you need to log in
[NotMapped]
public int AvailableCount {
get
{
int someInt = 12;
return someInt;
}
}
create a separate file
public partial class Book{
[NotMapped]
public int AvailableCount {
get
{
// Логика..
int someInt = 12;
return someInt;
}
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question