execute stored procedure in entity Framework Core without expecting map to dbset
If you are not on version 2.1, you will need to add:
public DbSet<ClaimDataView> ClaimDataView { get; set; }
to your moduleContext. And add NotMapped to your class:
[NotMapped]
public class ClaimDataView
You can utilize the Query Types introduced in EF Core 2.1.
First you need to register you class as query type:
modelBuilder.Query<ClaimDataView>();
Then you can use Context.Query<ClaimDataView>()
in place of your current Context.Claims
:
var query = Context.Query<ClaimDataView>().FromSql(...);
Update (EF Core 3.x+):
Starting with EF Core 3.0, query types have been consolidated with entity types and renamed to Keyless Entity Types, so the corresponding code is
modelBuilder.Entity<ClaimDataView>().HasNoKey().ToView(null);
and
var query = Context.Set<ClaimDataView>().FromSql(...);