Steven Giesel 8/11/2025

How to not return all properties in SqlRaw

Read Original

This technical article addresses a specific limitation in Entity Framework's SqlRaw method, which requires a SQL query to return data for all properties of the entity type. It provides a practical solution: for any optional properties not present in the SELECT clause, explicitly return them as NULL (e.g., 'NULL AS PropB') to satisfy EF's mapping and avoid exceptions.

How to not return all properties in SqlRaw

Comments

No comments yet

Be the first to share your thoughts!

Browser Extension

Get instant access to AllDevBlogs from your browser

Top of the Week