Saturday, April 20, 2024
HomeHow ToWorking with data in Entity Developer? It's simple.

Working with data in Entity Developer? It’s simple.

When designing 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. Now Entity Developer allows viewing and editing data of tables, views, and model entities, create and execute LINQ to SQL and Entity SQL queries against the model, eliminating the need for additional applications and reducing time for accessing these operations.

Editing Database Data

Entity Developer allows you to directly edit database data in the tables or views. Just right-click the table or view in the Database Explorer window and choose Retrieve Data from the popup menu. A new window will open with two tabs: Data and SQL.

Table data

SQL tab contains the SQL query to the specified table or view. Data tab displays table or view data, which you can edit.

To edit data in the cell click on a cell you want to edit. After making any changes to the cell, press to confirm changes or ESCAPE to cancel. To add a new record, click the ‘+’ button under the grid. To delete a record from the grid, click the ‘-‘ button under the grid. You may also use grid popup menu for insert and delete operations.

Verifying Mapping

Do you need to verify if your mapping is correct, to see your entity data? Right-click it on the diagram or in Project Explorer and choose Retrieve Data from the popup menu. A new window will open with Data and SQL tabs. Here you can see your entity data and SQL code of the query to make sure the entity is mapped correctly. The entity data cannot be edited.

Entity data

When you retrieve data from an entity, that have associations, you may view not just the entity data, but also the data from the entities, connected with the current by associations. Each record will have + button in its first cell. Click it to expand tabs with data grids. Each tab corresponds to the entity, that is connected to the current with an association and contains records, that have the same association referential constraint property value as the “expanded” record.

You can click the Grid_Magnifier button to resize the tabs to the whole main grid area. The button in the upper left corner restores the original layout. Each expanded grid also contains records with the + button, allowing you to browse the associations further.

LINQ to SQL and Entity SQL queries

When designing LINQ to SQL or Entity Framework model, it is often necessary to quickly design and debug LINQ to SQL or Entity SQL query. Now you can use our built-in query editor, which is similar to LINQPad for these purposes.

To quickly create a query, perform the following steps:

QueryEditor

  1. Open the query editor by choosing New Query from the File menu or press CTRL+Q.
  2. On the Query toolbar choose the needed query type from the drop-down list.
  3. Type the query code or drag the entity from the Project Explorer to the query.
  4. Click the Run Query button on the Query toolbar or press F5.

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. 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.

Queries can be saved for future use.

RELATED ARTICLES

Whitepaper

Social

Topics

Products