New Posts New Posts RSS Feed: Multiple DB calls when accessing a View
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Multiple DB calls when accessing a View

 Post Reply Post Reply
Author
jeanb View Drop Down
Newbie
Newbie
Avatar

Joined: 04-Apr-2012
Location: South Africa
Posts: 5
Post Options Post Options   Quote jeanb Quote  Post ReplyReply Direct Link To This Post Topic: Multiple DB calls when accessing a View
    Posted: 06-Feb-2013 at 8:05pm
I have a strange problem.  I have a normal SQL view which I have added to my entity model (it has 2993 rows).  I call entitymanager.(myviews).ExecuteAsync().  I trace this in SQL profiler.  I see the normal batch call.  I then see 350 SP calls with exactly the same batch call SQL query.

I thought maybe the problem was the view didn't have a primary key, so I added one as a string combination of primary keys, and I updated the model entity so that this was the only entity key, but it had no effect.

I am stumped.  Why is IdeaBlade calling the exact same SQL code 350 times after the batch call?  If I call the view with a specific record, it does the same thing.

I've added the 3 of the SQL trace rows below, there are 350 more of these:

OperationsEntities.vwSupplierServiceRouteYesList.ExecuteAsync();

SQL:BatchStarting
SELECT
[Extent1].[SupplierId] AS [SupplierId],
[Extent1].[SupplierAccountNumber] AS [SupplierAccountNumber],
[Extent1].[SupplierName] AS [SupplierName],
[Extent1].[SupplierServiceId] AS [SupplierServiceId],
[Extent1].[SupplierService] AS [SupplierService],
[Extent1].[RouteId] AS [RouteId],
[Extent1].[RouteCode] AS [RouteCode],
[Extent1].[Route] AS [Route],
[Extent1].[IsPreferredSupplier] AS [IsPreferredSupplier],
[Extent1].[AutoGenerateSupplierManifestNumber] AS [AutoGenerateSupplierManifestNumber],
[Extent1].[PrimaryKey] AS [PrimaryKey]
FROM (SELECT
      [vwSupplierServiceRouteYes].[SupplierId] AS [SupplierId],
      [vwSupplierServiceRouteYes].[SupplierAccountNumber] AS [SupplierAccountNumber],
      [vwSupplierServiceRouteYes].[SupplierName] AS [SupplierName],
      [vwSupplierServiceRouteYes].[SupplierServiceId] AS [SupplierServiceId],
      [vwSupplierServiceRouteYes].[SupplierService] AS [SupplierService],
      [vwSupplierServiceRouteYes].[RouteId] AS [RouteId],
      [vwSupplierServiceRouteYes].[RouteCode] AS [RouteCode],
      [vwSupplierServiceRouteYes].[Route] AS [Route],
      [vwSupplierServiceRouteYes].[IsPreferredSupplier] AS [IsPreferredSupplier],
      [vwSupplierServiceRouteYes].[AutoGenerateSupplierManifestNumber] AS [AutoGenerateSupplierManifestNumber],
      [vwSupplierServiceRouteYes].[PrimaryKey] AS [PrimaryKey]
      FROM [dbo].[vwSupplierServiceRouteYes] AS [vwSupplierServiceRouteYes]) AS [Extent1]

SP:Starting
SELECT
[Extent1].[SupplierId] AS [SupplierId],
[Extent1].[SupplierAccountNumber] AS [SupplierAccountNumber],
[Extent1].[SupplierName] AS [SupplierName],
[Extent1].[SupplierServiceId] AS [SupplierServiceId],
[Extent1].[SupplierService] AS [SupplierService],
[Extent1].[RouteId] AS [RouteId],
[Extent1].[RouteCode] AS [RouteCode],
[Extent1].[Route] AS [Route],
[Extent1].[IsPreferredSupplier] AS [IsPreferredSupplier],
[Extent1].[AutoGenerateSupplierManifestNumber] AS [AutoGenerateSupplierManifestNumber],
[Extent1].[PrimaryKey] AS [PrimaryKey]
FROM (SELECT
      [vwSupplierServiceRouteYes].[SupplierId] AS [SupplierId],
      [vwSupplierServiceRouteYes].[SupplierAccountNumber] AS [SupplierAccountNumber],
      [vwSupplierServiceRouteYes].[SupplierName] AS [SupplierName],
      [vwSupplierServiceRouteYes].[SupplierServiceId] AS [SupplierServiceId],
      [vwSupplierServiceRouteYes].[SupplierService] AS [SupplierService],
      [vwSupplierServiceRouteYes].[RouteId] AS [RouteId],
      [vwSupplierServiceRouteYes].[RouteCode] AS [RouteCode],
      [vwSupplierServiceRouteYes].[Route] AS [Route],
      [vwSupplierServiceRouteYes].[IsPreferredSupplier] AS [IsPreferredSupplier],
      [vwSupplierServiceRouteYes].[AutoGenerateSupplierManifestNumber] AS [AutoGenerateSupplierManifestNumber],
      [vwSupplierServiceRouteYes].[PrimaryKey] AS [PrimaryKey]
      FROM [dbo].[vwSupplierServiceRouteYes] AS [vwSupplierServiceRouteYes]) AS [Extent1]

SP:Starting
SELECT
[Extent1].[SupplierId] AS [SupplierId],
[Extent1].[SupplierAccountNumber] AS [SupplierAccountNumber],
[Extent1].[SupplierName] AS [SupplierName],
[Extent1].[SupplierServiceId] AS [SupplierServiceId],
[Extent1].[SupplierService] AS [SupplierService],
[Extent1].[RouteId] AS [RouteId],
[Extent1].[RouteCode] AS [RouteCode],
[Extent1].[Route] AS [Route],
[Extent1].[IsPreferredSupplier] AS [IsPreferredSupplier],
[Extent1].[AutoGenerateSupplierManifestNumber] AS [AutoGenerateSupplierManifestNumber],
[Extent1].[PrimaryKey] AS [PrimaryKey]
FROM (SELECT
      [vwSupplierServiceRouteYes].[SupplierId] AS [SupplierId],
      [vwSupplierServiceRouteYes].[SupplierAccountNumber] AS [SupplierAccountNumber],
      [vwSupplierServiceRouteYes].[SupplierName] AS [SupplierName],
      [vwSupplierServiceRouteYes].[SupplierServiceId] AS [SupplierServiceId],
      [vwSupplierServiceRouteYes].[SupplierService] AS [SupplierService],
      [vwSupplierServiceRouteYes].[RouteId] AS [RouteId],
      [vwSupplierServiceRouteYes].[RouteCode] AS [RouteCode],
      [vwSupplierServiceRouteYes].[Route] AS [Route],
      [vwSupplierServiceRouteYes].[IsPreferredSupplier] AS [IsPreferredSupplier],
      [vwSupplierServiceRouteYes].[AutoGenerateSupplierManifestNumber] AS [AutoGenerateSupplierManifestNumber],
      [vwSupplierServiceRouteYes].[PrimaryKey] AS [PrimaryKey]
      FROM [dbo].[vwSupplierServiceRouteYes] AS [vwSupplierServiceRouteYes]) AS [Extent1]
Back to Top
jeanb View Drop Down
Newbie
Newbie
Avatar

Joined: 04-Apr-2012
Location: South Africa
Posts: 5
Post Options Post Options   Quote jeanb Quote  Post ReplyReply Direct Link To This Post Posted: 06-Feb-2013 at 10:12pm
It's not IdeaBlade or the entity query, it's happening when called from SQL too.  Weird, but not for this forum, sorry.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down