Entity framework Core Raw SQLQueries with custom model

后端 未结 4 1421
难免孤独
难免孤独 2021-02-14 20:39

Using Entity Framework 6, I was able to use execute a Raw SQL Query and use a custom model which was not defined in the DBContext in order to store the output of the query. A si

4条回答
  •  爱一瞬间的悲伤
    2021-02-14 21:24

    From .NET Core 2.1:

    1. Add modelBuilder.Query() to OnModelCreating(ModelBuilder modelBuilder)

    2. Use context.Query().FromSql(rawSql) to get data

提交回复
热议问题