Creating and Executing Queries

When designing a model, and especially when debugging it, it is often necessary to view and edit table and view data or fill tables with some test data. Entity Developer allows viewing and editing data in tables, views, and model entities, creating and executing LINQ, HQL, and Entity SQL queries against the model, eliminating the need for additional applications.

Entity SQL queries can be executed only for Entity Framework models, HQL queries can be executed only against NHibernate models, while LINQ queries can be executed against all model types. To switch the query type (for the Entity Framework models), use the drop-down list on the Query toolbar.

To create a query, click the Images_ToolbarButtons_NewSQLEditor Create New Query button on the Standard toolbar or press CTRL+Q. The Query Document is displayed. Type the query code or drag the entity from the Model Explorer to the query editor. Please note, that only entities corresponding to the classes can be dragged to the query editor. After that you may execute it by clicking the Images_ToolbarButtons_Run! Run Query button on the Query toolbar.

note Note

To create a new query in Visual Studio add-in, choose New Query from the Tools -> Entity Developer menu.

After executing query, the results are displayed in the tabs below the query text. If the query executed  successfully, Data tab contains the data the query returned. For more information see How To: View and Edit Data. SQL tab contains SQL code that was executed for the query. Error information is available in the Error tab if errors occurred when executing query.

Images_Query

Queries can be saved for the future use as *.eqry files. To save the query click the Save button on the Standard toolbar. Then choose the file location in the Save dialog and click the Save button. To open the query choose Open Query in the File menu.

ExpandedToggleIcon        See Also


Send feedback on this topic

© 2008 - 2024 Devart. All rights reserved.