I have an entity with a field that should not be created in the database, but should be filled from a stored procedure.
public class Item
{
public int Id {get; set;}
public int CalculatedField {get; set;}
}
Then I want to fill it with a stored procedure
var items = _db.Items.FromSqlRaw("select * from StoredProcedure()").ToList()
But if I use [NotMapped]
attribute or .Ignore
fluent option - the EF the field completely, and even though my stored procedure returns CalculatedField
, EF does not use it.
Is there any way to achieve this behavior?