I try to load an entity with EF Core by calling a stored procedure. The entity is mapped to a table by fluent mapping which does not contain all columns which are selected by the stored procedure.
The selected fields which do not exist as table columns are ignored in the entity configuration like this:
modelBuilder.Entity<CustomerLocationEntity>().Ignore(c => c.Latitude);
modelBuilder.Entity<CustomerLocationEntity>().Ignore(c => c.Longitude);
modelBuilder.Entity<CustomerLocationEntity>().Ignore(c => c.Radius);
modelBuilder.Entity<CustomerLocationEntity>().Ignore(c => c.Distance);
The stored procedure is called like this:
await SalesContext.CustomerLocation
.FromSql("GetCustomersByLocation @latitude={0}, @longitude={1}, @radius={2}", lat,
lon, radius)
.ToListAsync();
When the query is executed the ignored columns are not mapped to the entity. Is there any possibility to map the ignored fields to the entity when calling a stored procedure or do I have to create another entity for the stored procedure or something like this?