Entity Developer allows mapping results of raw SQL queries to classes for Entity Framework Core.
To create a class from the result of raw SQL query, perform the following steps:
1. | Add a new class to the model as usually (See Creating and Editing Classes). Don't set its Table property. You also don't need to specify its properties, because they can be autogenerated from the results of the query. |
2. | In the properties of this class, click the Raw SQL Query property. Then click the three-dotted button in this property.
|
3. | In the opened editor, enter the SQL query. You may click Execute and preview the data to make sure everything is correct. |
4. | Click OK. Entity Developer will ask whether to re-generate the class's Properties collection. Click Yes to re-generate properties. Property names will be generated from the names of the resultset columns.
|
Note that you can edit the Raw SQL Query property only for classes with the empty Table property.
|
• | For classes of entity type, generated from a raw SQL query, Entity Developer generates an IQueryable collection, not an EntitySet. |
• | For classes of query type, generated from a raw SQL query, Entity Developer generates an DbQuery collection |
• | The objects, returned by a raw SQL query, are read-only. |
|
See Also
Send feedback on this topic
© 2008 - 2024 Devart. All rights reserved.