01000001 01010011
01000001 01010011

Reputation: 71

EDMX update model from database Timeout

I have a MSSQL DB with about 3300tables (don't ask why, that's Nav...). When I try to "Update Model from Database..." on my EDMX I am getting a timeout exception 99 times out of 100. So my question is, is there anyway to change the timeout? I have tried to set "Connect Timeout" in the connection string, but it doesn't change anything.

I also tried to create a SQL account with an access on only the tables I need (about 10) but the timeout in the wizard still occur.

Upvotes: 4

Views: 1089

Answers (2)

user3236794
user3236794

Reputation: 608

Someone at work just helped me with this.

  1. Run a SQL profiler and try to update your model again.
  2. Capture the SQL Query that Visual Studio trys to run. It should look something like this

    SELECT 
    [Project1].[C1] AS [C1], 
    [Project1].[CatalogName] AS [CatalogName], 
    [Project1].[SchemaName] AS [SchemaName], 
    [Project1].[Name] AS [Name]
    FROM ( SELECT 
        [Extent1].[CatalogName] AS [CatalogName], 
        [Extent1].[SchemaName] AS [SchemaName], 
        [Extent1].[Name] AS [Name], 
        1 AS [C1]
        FROM (
        SELECT
        quotename(TABLE_SCHEMA) + quotename(TABLE_NAME) [Id]
        ,   TABLE_CATALOG [CatalogName]
        ,   TABLE_SCHEMA [SchemaName]
        ,   TABLE_NAME    [Name]
        FROM
        INFORMATION_SCHEMA.TABLES
        WHERE
        TABLE_TYPE = 'BASE TABLE'
      ) AS [Extent1]
    )  AS [Project1]
    ORDER BY [Project1].[SchemaName] ASC, [Project1].[Name] ASC
    
  3. Then run the query in SS Managment Studio. When you run the query the results should be cached. When Visual Studio runs the query again the results should come back really quick and it won't time out.

Upvotes: 3

01000001 01010011
01000001 01010011

Reputation: 71

A small work around :

  • Generate an sql script to create only the tables you need from the DB
  • Create another DB and execute the sql script
  • Generate the EDMX from this new DB
  • Change the connection string of the EDMX to connect to the first DB

Upvotes: 0

Related Questions