---
title: "You can now return unmapped types from raw SQL select statements with Entity Framework 8"
url: https://daily.dev/posts/you-can-now-return-unmapped-types-from-raw-sql-select-statements-with-entity-framework-8-ct4qudcft
source_url: https://timdeschryver.dev/blog/you-can-now-return-unmapped-types-from-raw-sql-select-statements-with-entity-framework-8
type: article
source: "Tim Deschryver"
author: "Tim Deschryver"
published: 2026-05-31T07:47:30.837Z
updated: 2026-08-24T07:00:28.391Z
tags: [".net"]
reading_time: 6
upvotes: 0
comments: 0
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# You can now return unmapped types from raw SQL select statements with Entity Framework 8

**[Tim Deschryver](https://daily.dev/sources/timdeschryver)** · [@timdeschryver](https://daily.dev/timdeschryver) · 6 min read · 0 upvotes · 0 comments

## Summary

Entity Framework Core 8 Preview 1 introduces the ability to execute raw SQL select statements and map results to any unmapped type, not just natively supported primitives or database model entities. Using the new SqlQuery and SqlQueryRaw methods, developers can now write custom SQL queries returning arbitrary types. This is useful for data migration tasks, hot code paths requiring fine-grained query optimization, and reducing dependencies on additional ORMs like Dapper. The feature returns IQueryable, and SqlQuery is preferred over SqlQueryRaw to avoid SQL injection risks.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://timdeschryver.dev/blog/you-can-now-return-unmapped-types-from-raw-sql-select-statements-with-entity-framework-8>

---

Tags: [#.net](https://daily.dev/tags/.net)

[View this post on daily.dev](https://daily.dev/posts/you-can-now-return-unmapped-types-from-raw-sql-select-statements-with-entity-framework-8-ct4qudcft)
