Topic
29 replies Latest Post - ‏2012-08-22T19:59:38Z by u234jaslfj
calinarens
calinarens
7 Posts
ACCEPTED ANSWER

Pinned topic Entity framework: Update Model from Database does not work

‏2009-08-26T14:29:32Z |
I can add a new ADO.NET Entity Data Model, select tables, use LINQ to query, etc. and everything works fine.
As soon as I want to add some tables or so using right-click on the model and "Update Model from Database...", the following error is written in the dialog after a while:
"Error retrieving database information. Error message: 'An item with the same key has already been added.'"
How to fix? :-)
Updated on 2012-08-22T19:59:38Z at 2012-08-22T19:59:38Z by u234jaslfj
  • SystemAdmin
    SystemAdmin
    2826 Posts
    ACCEPTED ANSWER

    Re: Entity framework: Update Model from Database does not work

    ‏2009-09-10T02:39:16Z  in response to calinarens
    Same problem when creating an ado.net entity data model of db2v9.1 in vs2008sp1.
  • roman.temek
    roman.temek
    1 Post
    ACCEPTED ANSWER

    Re: Entity framework: Update Model from Database does not work

    ‏2010-01-30T18:54:36Z  in response to calinarens
    I have the same problem.
    VS2008 SP1
    Windows XP SP3
    Data Server Client v9.7 FP0
    target db - DB2 9.5 on AIX 64

    I tried to do the same from another pc (with Vista installed), but had the same error.
    Does anyone has a solution for this? Or at least does anyone investigate this issue? I have tried all versions of Data Server Client starting from 9.5 fp3 to make LinqToSql or EF work properly, but with no results :(
    • SystemAdmin
      SystemAdmin
      2826 Posts
      ACCEPTED ANSWER

      Re: Entity framework: Update Model from Database does not work

      ‏2010-02-01T21:27:08Z  in response to roman.temek
      Hi,

      I did a quick search of the error you mention. This is definitely a message that Microsoft generates in a number of situations, even situations that does not involve the EDM. I also found some references of users getting this error when using providers other than IBM's. Given this information, I think it would be worthy of contacting Microsoft for assistance.

      Since you're reproducing the problem, and it sounds like you can reproduce it pretty consistently, with the IBM provider, I also think it is worthy to direct you to IBM Technical Support for assistance with the issue. With the information presented, I cannot absolutely rule out the IBM .NET Provider as contributing to the error generated.

      However, due to the wide range of scenarios that I found during my quick internet search of this error, I don't think that you'll have a satisfactory response from the forum. I believe the problem resolution will require more diagnostic efforts than what can be provided in the forum setting.

      Thanks
      • SystemAdmin
        SystemAdmin
        2826 Posts
        ACCEPTED ANSWER

        Re: Entity framework: Update Model from Database does not work

        ‏2010-04-08T15:37:49Z  in response to SystemAdmin
        Has this been resolved? I am getting the same error. Any suggestions is appreciated from those of you who have seen this error.
      • vikrantislav
        vikrantislav
        20 Posts
        ACCEPTED ANSWER

        Re: Entity framework: Update Model from Database does not work

        ‏2011-07-06T20:06:19Z  in response to SystemAdmin
        Reece,

        Any update on this since the last post? I'm having the same problem. I have 9.7fp4 hitting DB2 9.5 on AIX64. Using Visual Studio 2010 SP1.

        Fyi, when I search for the full error text, "Error retrieving database information." "An item with the same key has already been added.", the only data provider coming up in the results is IBM DB2.

        Thanks.
  • MartyOne
    MartyOne
    14 Posts
    ACCEPTED ANSWER

    Re: Entity framework: Update Model from Database does not work

    ‏2011-07-08T14:55:37Z  in response to calinarens
    Hello, I have same problem with DB2 9.87 FP4 Drivers to .NET 4.0 VS 2010 add-ins.
    I can select a table to generate EDMX but when it tries to create the entities, it takes a while and I get a SQL ASUTIME error and "item with same key already exists" also. DBAs want to know the SQL being generated but I don't know how to help them. I can use the driver for all other functions, just not allowing me to create model from DB2 database on z/os 9.7.
    thanks
    • vikrantislav
      vikrantislav
      20 Posts
      ACCEPTED ANSWER

      Re: Entity framework: Update Model from Database does not work

      ‏2011-07-08T15:48:14Z  in response to MartyOne
      MartyOne,

      The ASUTIME error is a slightly different issue. You should be able to correct that by adding a filter. See this post: https://www.ibm.com/developerworks/forums/thread.jspa?threadID=366580&tstart=25
      • JohnBishop
        JohnBishop
        2 Posts
        ACCEPTED ANSWER

        Re: Entity framework: Update Model from Database does not work

        ‏2011-07-08T18:06:10Z  in response to vikrantislav
        I too am unable to generate a model from the database. I'm getting a different error though. Mine looks like this:

        Unable to generate the model because of the following exception: 'An error occurred while executing the command definition. See the inner exception for details.
        ERROR 42625 IBMDB2 SQL0582N A CASE expression in a VALUES clause, IN predicate, GROUP BY clause, or ORDER BY clause cannot include a quantified predicate, an IN predicate using a fullselect, or an EXISTS predicate.
        '.

        I'm running DB2 v9.7.400.501 on a Windows 7 Pro x64 in VS2010 against a zOS back end.
      • MartyOne
        MartyOne
        14 Posts
        ACCEPTED ANSWER

        Re: Entity framework: Update Model from Database does not work

        ‏2011-07-08T19:33:49Z  in response to vikrantislav
        Thank you for the quick response. I tried applying schema and table filters for generating the model but something interesting. If I create a database connection with filters, it definitely works, but when I create a model using that connection - I do see the filtered list of tables (about 10) - but selecting one or more just results in five minutes of waiting and the ASUTIME error. If I try to create a new connection using the Create Entity Data Model wizard, the filters in that connection dialog don't seem to work, if I apply any filters at all, I don't get any tables to choose from - so the filters are working differently in this case. So, while I can browse tables in the Data Connections view in VS 2010, I still cannot create a model from the database using these Add-Ins for 2010. Any other ideas?
        • vikrantislav
          vikrantislav
          20 Posts
          ACCEPTED ANSWER

          Re: Entity framework: Update Model from Database does not work

          ‏2011-07-08T19:55:45Z  in response to MartyOne
          MartyOne,

          As for the second problem you mention of applying a filter and then not getting any tables to choose from, I encountered that also. Try adding a "%" character (percent symbol, without quotes) at the end of your filter text. So if your filter was "ABC", try "ABC%".
          • MartyOne
            MartyOne
            14 Posts
            ACCEPTED ANSWER

            Re: Entity framework: Update Model from Database does not work

            ‏2011-07-12T20:23:48Z  in response to vikrantislav
            Hi, yeah, I tried specifying schema and table filters to no avail. The EDM Wizard just does not honor setting filters while the data connections do. I'm not sure if this is a driver installation issue or not, all I have is 9.7 FP4.

            From reading it sounds like the Add-Ins are not that stable with this first release. Does anyone know if FP5 will even address things like real-world modeling to DB2 databases where you need to specify schemas and filters? Sounds like a lot of developers are having issues with the add-ins getting the model to work like it does with SQL Server native drivers.

            I'm tempted to have my DBA restrict me from all by tables I need in my schema so I don't have to query 30k objects and the wizard won't time out on ASUTIME.

            thanks
            • SystemAdmin
              SystemAdmin
              2826 Posts
              ACCEPTED ANSWER

              Re: Entity framework: Update Model from Database does not work

              ‏2011-07-12T21:59:37Z  in response to MartyOne
              Hi MartyOne,

              The Schema filter for the connection in the server explorer can only contain a full schema name, i.e. as if specifying an == SQL predicate. I.e. if you're looking for tables belonging in schema FOO then the schema filter field should be set to FOO. However, the object name filters conform to LIKE predicate rules and thus can be specified using wild cards.
              Also, in order to verify whether your filtering predicates are being applied, you can start DB2 tracing utility ( https://db2id.torolab.ibm.com/db2doc_v97fp5/topic/com.ibm.db2.luw.admin.trb.doc/doc/c0020800.html) with the following mask "..CLI.CLI_scnTranslateSQL.*" before selecting tables and clicking OK in the EDM wizard. That will capture all the SQL statements being sent to the server which you can then inspect for the presence of the filtering predicates ( search for your schema name and object name filters ). The tracing commands are as follows:

              
              db2trc on -m 
              "*.*.CLI.CLI_scnTranslateSQL.*" -f <trcfile>    <--- will start the trace db2trc off                                                   <--- will stop the trace db2trc fmt <trcfile> <fmtfile>                               <--- will format the trace into readable format
              


              Please let me know if the filtering predicates are present in the SQL queries.

              Thanks,
              Alex
              • SystemAdmin
                SystemAdmin
                2826 Posts
                ACCEPTED ANSWER

                Re: Entity framework: Update Model from Database does not work

                ‏2011-07-12T22:02:11Z  in response to SystemAdmin
                Sorry, posted a wrong link for DB2 Trace docs. Here's the correct link:

                http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/topic/com.ibm.db2.luw.admin.trb.doc/doc/c0020800.html

                Regards,
                Alex
                • SystemAdmin
                  SystemAdmin
                  2826 Posts
                  ACCEPTED ANSWER

                  Re: Entity framework: Update Model from Database does not work

                  ‏2011-07-12T22:13:16Z  in response to SystemAdmin
                  Hi JohnBishop,

                  what version of the DB2 on z/OS are you running against?

                  Also, if possible, could you take the trace using the instructions I posted earlier and post the queries that are being submitted to the server. Based on that, as well as the server version info, I might have a better idea what is going on.

                  Thanks,
                  Alex
                  • SystemAdmin
                    SystemAdmin
                    2826 Posts
                    ACCEPTED ANSWER

                    Re: Entity framework: Update Model from Database does not work

                    ‏2011-07-12T22:16:57Z  in response to SystemAdmin
                    Hi vikrantislav,

                    what are the exact actions that you're performing in VS that lead to the error you're seeing?

                    Thanks,
                    Alex
                    • vikrantislav
                      vikrantislav
                      20 Posts
                      ACCEPTED ANSWER

                      Re: Entity framework: Update Model from Database does not work

                      ‏2011-07-14T15:28:18Z  in response to SystemAdmin
                      Alex,

                      I created an EDM which consists of 11 Views.
                      I assigned the correct primary keys.
                      I assigned the proper relationships and constraints.
                      Then, some time later, I right click in the model and select "Update Model from Database..."
                      I select the appropriate connection options, click Next.
                      For a moment the Wizard says, "Retrieving database information, please wait..."
                      Then it returns with, "Error retrieving database information. Error message: An item with the same key has already been added."
                      • SystemAdmin
                        SystemAdmin
                        2826 Posts
                        ACCEPTED ANSWER

                        Re: Entity framework: Update Model from Database does not work

                        ‏2011-07-18T15:05:22Z  in response to vikrantislav
                        Hi vikrantislav,

                        I was able to reproduce the issue you're seeing however, there doesn't appear to be anything that our provider is doing wrong that would cause this error. I am now persuing this issue with Microsoft. I will keep you posted on anything I find out.

                        Regards,
                        Alex
                        • SystemAdmin
                          SystemAdmin
                          2826 Posts
                          ACCEPTED ANSWER

                          Re: Entity framework: Update Model from Database does not work

                          ‏2011-07-26T18:18:12Z  in response to SystemAdmin
                          Hi vikrantislav,

                          can you please double check the version of the server you're going against. I want to make sure it's 9.5 and not 9.7. The reason I ask is that my repro scenario would only be applicable to 9.7 servers which introduced module support, thus allowing creation of stored procedures with the same name under the same schema ( but different modules ). Since key generation doesn't take module into account, having SPs with the same name under different modules would produce collision. However, module support was introduced in 9.7, so if you're running against 9.5 server, then this is not the issue you're hitting.

                          Thanks,
                          Alex
                          • vikrantislav
                            vikrantislav
                            20 Posts
                            ACCEPTED ANSWER

                            Re: Entity framework: Update Model from Database does not work

                            ‏2011-07-26T20:51:16Z  in response to SystemAdmin
                            Alex,

                            It is DB2/AIX64 09.05.0002. Thanks for your research into this, the details in your post made me realize something. When I have two stored procedures with same name but different definition this seems to be the cause. After removing the duplicate named stored procs I get a list of db objects to select from in the Update wizard. Maybe using the Package ID as the key instead of stored proc name would avoid this?

                            Thanks.
              • MartyOne
                MartyOne
                14 Posts
                ACCEPTED ANSWER

                Re: Entity framework: Update Model from Database does not work

                ‏2011-07-14T05:25:24Z  in response to SystemAdmin
                Alex, thank you very much. I was able to perform a trace like you suggested and I saw some peculiarities. I'm tring to pull in about ten tables from a schema called "GEG1" and lets assume that most tables start with renewal "RENL_".
                Here's what I noticed in the filter parts while EDM builds its tables to select from in the wizard.

                Schema filter : GEG1 - seems to work by itself although when I select tables, I timeout.
                Table Type Filter : none, although I saw a few queries asking for name in ('V') where I would have expected 'T'.
                Table Filter : here I used "%RENL_%" as a like expression. I noticed that some queries were appending a while card while others were not. Not sure if that is a bug.

                The real issue seems to be that after the wizard builds its three queries of gathering tables, views and procs and then grabs them all again only to filter out later the tables I actually selected (which seems fine), at some point where it goes after the column info and then sysrels info, it seems that these queries are taking way too long.

                Here's the query that seemed to take forever, cut to the chase and try to figure out why this query takes 90 seconds to execute... seems a long time to get table info. Let me know what you think. I assume the parameter ? here is a table name that I selected. This query takes about 90 seconds for one table.

                If I execute this query in a ODBC command, I get an error, IBM.Data.DB2.DB2Exception (0x80004005): ERROR 57014 IBMDB2 SQL0952N Processing was cancelled due to an interrupt. If I raise the CommandTimeout to larger like 300seconds, it works.

                Could the timeout issue be affecting the wizard which the 64k question is - how do I configure EDM to use a command timeout of say 120s ?

                Query:

                SELECT Project6.C2 AS C1, Project6.CatalogName AS CatalogName, Project6.SchemaName AS SchemaName, Project6.Name AS Name, Project6.C1 AS C2,
                Project6.C3 AS C3, Project6.C4 AS C4, Project6.C5 AS C5, Project6.C6 AS C6, Project6.C7 AS C7, Project6.C8 AS C8, Project6.C9 AS C9,
                Project6.C10 AS C10, Project6.C11 AS C11 FROM ( SELECT Extent1.CatalogName AS CatalogName, Extent1.SchemaName AS SchemaName, Extent1.Name AS Name,
                UnionAll1.Name AS C1, UnionAll1.Ordinal AS C2, UnionAll1.IsNullable AS C3, UnionAll1.TypeName AS C4, UnionAll1.MaxLength AS C5, UnionAll1.Precision AS C6,
                UnionAll1.DateTimePrecision AS C7, UnionAll1.Scale AS C8, UnionAll1.IsIdentity AS C9, UnionAll1.IsStoreGenerated AS C10,
                CASE WHEN (Project5.C2 IS NULL) THEN CAST(0 AS smallint) ELSE Project5.C2 END AS C11
                FROM ( SELECT '' || '' AS Id , RTRIM(DBNAME) AS CatalogName ,
                RTRIM(CREATOR) AS SchemaName , RTRIM(NAME) AS Name , CAST(NULL AS clob) AS ViewDefinition ,
                CAST(0 AS smallint) AS IsUpdatable FROM SYSIBM.SYSTABLES WHERE TYPE = 'V' AND CREATOR IN ( 'GEG1' ) ) AS Extent1
                INNER JOIN (SELECT Extent2.Id AS Id, Extent2.Name AS Name, Extent2.Ordinal AS Ordinal, Extent2.IsNullable AS IsNullable,
                Extent2.TypeName AS TypeName, Extent2.MaxLength AS MaxLength, Extent2.Precision AS Precision, Extent2.DateTimePrecision AS DateTimePrecision,
                Extent2.Scale AS Scale, Extent2.IsIdentity AS IsIdentity, Extent2.IsStoreGenerated AS IsStoreGenerated, CAST(4 AS int) AS C1,
                Extent2.ParentId AS ParentId
                FROM ( SELECT '' || '' || '' AS Id ,
                '' || '' AS ParentId , RTRIM(c.NAME) AS Name , CAST(c.COLNO AS integer) AS Ordinal ,
                CAST(CASE c.NULLS WHEN 'Y' THEN 1 WHEN 'N' THEN 0 ELSE 0 END AS smallint) AS IsNullable ,
                RTRIM(LOWER(CASE c.COLTYPE WHEN 'INTEGER' THEN 'INT' WHEN 'DOUBLE' THEN 'FLOAT' WHEN 'REAL' THEN 'FLOAT' WHEN 'TIMESTMP' THEN 'TIMESTAMP' WHEN 'CHAR'
                THEN CASE c.FOREIGNKEY WHEN 'B' THEN 'CHAR FOR BIT DATA' ELSE 'CHAR' END WHEN 'VARCHAR' THEN CASE c.FOREIGNKEY WHEN 'B' THEN 'VARCHAR FOR BIT DATA'
                ELSE 'VARCHAR' END WHEN 'LONGVAR' THEN CASE c.FOREIGNKEY WHEN 'B' THEN 'LONG VARCHAR FOR BIT DATA' ELSE 'LONG VARCHAR' END WHEN 'VARG' THEN 'VARGRAPHIC'
                WHEN 'LONGVARG' THEN 'LONG VARGRAPHIC' WHEN 'VARBIN' THEN 'VARBINARY' ELSE c.COLTYPE END)) AS TypeName , CAST(CASE c.COLTYPE WHEN 'FLOAT' THEN 8
                WHEN 'CLOB' THEN c.LENGTH2 WHEN 'BLOB' THEN c.LENGTH2 WHEN 'DBCLOB' THEN c.LENGTH2 ELSE c.LENGTH END AS integer) AS MaxLength ,
                CAST(CASE c.COLTYPE WHEN 'DECIMAL' THEN c.LENGTH WHEN 'DECFLOAT' THEN CASE c.LENGTH WHEN 8 THEN 16 WHEN 16 THEN 34 END ELSE NULL END AS integer) AS Precision ,
                CAST(CASE c.COLTYPE WHEN 'TIMESTMP' THEN 6 WHEN 'DATE' THEN 0 WHEN 'TIME' THEN 0 ELSE NULL END AS integer) AS DateTimePrecision ,
                CAST(c.SCALE AS integer) AS Scale , CAST(NULL AS varchar(128)) AS CollationCatalog , CAST(NULL AS varchar(128)) AS CollationSchema ,
                CAST(NULL AS varchar(128)) AS CollationName , CAST(NULL AS varchar(128)) AS CharacterSetCatalog ,
                CAST(NULL AS varchar(128)) AS CharacterSetSchema , CAST(NULL AS varchar(128)) AS CharacterSetName , CAST(0 AS smallint) AS IsMultiSet ,
                CAST(CASE WHEN c.DEFAULT IN ('I', 'J') THEN 1 ELSE 0 END AS smallint) AS IsIdentity ,
                CAST(CASE WHEN c.DEFAULT IN ('A', 'D') THEN 1 ELSE 0 END AS smallint) AS IsStoreGenerated , c.DEFAULTVALUE AS Default FROM
                SYSIBM.SYSCOLUMNS c INNER JOIN SYSIBM.SYSTABLES t ON c.TBCREATOR = t.CREATOR AND c.TBNAME = t.NAME AND t.TYPE IN ( 'T' ) AND
                t.CREATOR IN ( 'GEG1' ) AND RTRIM(t.NAME) like '%RENL_%' ) AS Extent2 UNION ALL SELECT Extent3.Id AS Id, Extent3.Name AS Name,
                Extent3.Ordinal AS Ordinal, Extent3.IsNullable AS IsNullable, Extent3.TypeName AS TypeName, Extent3.MaxLength AS MaxLength,
                Extent3.Precision AS Precision, Extent3.DateTimePrecision AS DateTimePrecision, Extent3.Scale AS Scale, Extent3.IsIdentity AS IsIdentity,
                Extent3.IsStoreGenerated AS IsStoreGenerated, CAST(0 AS int) AS C1, Extent3.ParentId AS ParentId
                FROM ( SELECT '' || '' || '' AS Id ,
                '' || '' AS ParentId , RTRIM(c.NAME) AS Name ,
                CAST(c.COLNO AS integer) AS Ordinal , CAST(CASE c.NULLS WHEN 'Y' THEN 1 WHEN 'N' THEN 0 ELSE 0 END AS smallint) AS IsNullable ,
                RTRIM(LOWER(CASE c.COLTYPE WHEN 'INTEGER' THEN 'INT' WHEN 'DOUBLE' THEN 'FLOAT' WHEN 'REAL' THEN 'FLOAT' WHEN 'TIMESTMP' THEN 'TIMESTAMP' WHEN 'CHAR'
                THEN CASE c.FOREIGNKEY WHEN 'B' THEN 'CHAR FOR BIT DATA' ELSE 'CHAR' END WHEN 'VARCHAR' THEN CASE c.FOREIGNKEY WHEN 'B' THEN 'VARCHAR FOR BIT DATA'
                ELSE 'VARCHAR' END WHEN 'LONGVAR' THEN CASE c.FOREIGNKEY WHEN 'B' THEN 'LONG VARCHAR FOR BIT DATA' ELSE 'LONG VARCHAR' END WHEN 'VARG' THEN 'VARGRAPHIC'
                WHEN 'LONGVARG' THEN 'LONG VARGRAPHIC' WHEN 'VARBIN' THEN 'VARBINARY' ELSE c.COLTYPE END)) AS TypeName , CAST(CASE c.COLTYPE WHEN 'FLOAT'
                THEN 8 WHEN 'CLOB' THEN c.LENGTH2 WHEN 'BLOB' THEN c.LENGTH2 WHEN 'DBCLOB' THEN c.LENGTH2 ELSE c.LENGTH END AS integer) AS MaxLength ,
                CAST(CASE c.COLTYPE WHEN 'DECIMAL' THEN c.LENGTH WHEN 'DECFLOAT' THEN CASE c.LENGTH WHEN 8 THEN 16 WHEN 16 THEN 34 END ELSE NULL END AS integer) AS Precision ,
                CAST(CASE c.COLTYPE WHEN 'TIMESTMP' THEN 6 WHEN 'DATE' THEN 0 WHEN 'TIME' THEN 0 ELSE NULL END AS integer) AS DateTimePrecision ,
                CAST(c.SCALE AS integer) AS Scale , CAST(NULL AS varchar(128)) AS CollationCatalog , CAST(NULL AS varchar(128)) AS CollationSchema ,
                CAST(NULL AS varchar(128)) AS CollationName , CAST(NULL AS varchar(128)) AS CharacterSetCatalog ,
                CAST(NULL AS varchar(128)) AS CharacterSetSchema , CAST(NULL AS varchar(128)) AS CharacterSetName ,
                CAST(0 AS smallint) AS IsMultiSet , CAST(CASE WHEN c.DEFAULT IN ('I', 'J') THEN 1 ELSE 0 END AS smallint) AS IsIdentity ,
                CAST(CASE WHEN c.DEFAULT IN ('A', 'D') THEN 1 ELSE 0 END AS smallint) AS IsStoreGenerated , c.DEFAULTVALUE AS Default
                FROM SYSIBM.SYSCOLUMNS c INNER JOIN SYSIBM.SYSTABLES t ON c.TBCREATOR = t.CREATOR AND c.TBNAME = t.NAME AND
                t.TYPE = 'V' AND t.CREATOR IN ( 'GEG1' ) ) AS Extent3) AS UnionAll1(Id, Name, Ordinal, IsNullable, TypeName, MaxLength, Precision, DateTimePrecision,
                Scale, IsIdentity, IsStoreGenerated, C1, ParentId) ON (CAST(0 AS int) = UnionAll1.C1) AND (Extent1.Id = UnionAll1.ParentId) LEFT OUTER JOIN
                (SELECT UnionAll2.Id AS C1, CAST(1 AS smallint) AS C2 FROM ( SELECT CAST(NULL AS varchar(1)) AS Id ,
                CAST(NULL AS varchar(255)) AS ParentId , CAST(NULL AS varchar(255)) AS Name , CAST(NULL AS varchar(255)) AS ConstraintType ,
                CAST(0 AS smallint) AS IsDeferrable , CAST(0 AS smallint) AS IsInitiallyDeferred , CAST(NULL AS varchar(255)) AS Expression ,
                CAST(NULL AS varchar(11)) AS UpdateRule , CAST(NULL AS varchar(11)) AS DeleteRule FROM SYSIBM.SYSDUMMY1 WHERE 1 = 2 ) AS Extent4
                INNER JOIN (SELECT CAST(10 AS int) AS C1, Extent5.ConstraintId AS ConstraintId, Extent6.Id AS Id
                FROM ( SELECT '' || '' AS ConstraintId ,
                '' || '' || '' AS ColumnId FROM SYSIBM.SYSKEYCOLUSE ) AS Extent5
                INNER JOIN ( SELECT '' || '' || '' AS Id ,
                '' || '' AS ParentId , RTRIM(c.NAME) AS Name , CAST(c.COLNO AS integer) AS Ordinal ,
                CAST(CASE c.NULLS WHEN 'Y' THEN 1 WHEN 'N' THEN 0 ELSE 0 END AS smallint) AS IsNullable ,
                RTRIM(LOWER(CASE c.COLTYPE WHEN 'INTEGER' THEN 'INT' WHEN 'DOUBLE' THEN 'FLOAT' WHEN 'REAL' THEN 'FLOAT' WHEN 'TIMESTMP' THEN 'TIMESTAMP' WHEN 'CHAR'
                THEN CASE c.FOREIGNKEY WHEN 'B' THEN 'CHAR FOR BIT DATA' ELSE 'CHAR' END WHEN 'VARCHAR' THEN CASE c.FOREIGNKEY WHEN 'B' THEN 'VARCHAR FOR BIT DATA'
                ELSE 'VARCHAR' END WHEN 'LONGVAR' THEN CASE c.FOREIGNKEY WHEN 'B' THEN 'LONG VARCHAR FOR BIT DATA' ELSE 'LONG VARCHAR' END WHEN 'VARG' THEN 'VARGRAPHIC'
                WHEN 'LONGVARG' THEN 'LONG VARGRAPHIC' WHEN 'VARBIN' THEN 'VARBINARY' ELSE c.COLTYPE END)) AS TypeName , CAST(CASE c.COLTYPE WHEN 'FLOAT'
                THEN 8 WHEN 'CLOB' THEN c.LENGTH2 WHEN 'BLOB' THEN c.LENGTH2 WHEN 'DBCLOB' THEN c.LENGTH2 ELSE c.LENGTH END AS integer) AS MaxLength ,
                CAST(CASE c.COLTYPE WHEN 'DECIMAL' THEN c.LENGTH WHEN 'DECFLOAT' THEN CASE c.LENGTH WHEN 8 THEN 16 WHEN 16 THEN 34 END ELSE NULL END AS integer) AS Precision ,
                CAST(CASE c.COLTYPE WHEN 'TIMESTMP' THEN 6 WHEN 'DATE' THEN 0 WHEN 'TIME' THEN 0 ELSE NULL END AS integer) AS DateTimePrecision ,
                CAST(c.SCALE AS integer) AS Scale , CAST(NULL AS varchar(128)) AS CollationCatalog , CAST(NULL AS varchar(128)) AS CollationSchema ,
                CAST(NULL AS varchar(128)) AS CollationName , CAST(NULL AS varchar(128)) AS CharacterSetCatalog ,
                CAST(NULL AS varchar(128)) AS CharacterSetSchema , CAST(NULL AS varchar(128)) AS CharacterSetName , CAST(0 AS smallint) AS IsMultiSet ,
                CAST(CASE WHEN c.DEFAULT IN ('I', 'J') THEN 1 ELSE 0 END AS smallint) AS IsIdentity ,
                CAST(CASE WHEN c.DEFAULT IN ('A', 'D') THEN 1 ELSE 0 END AS smallint) AS IsStoreGenerated , c.DEFAULTVALUE AS Default
                FROM SYSIBM.SYSCOLUMNS c INNER JOIN SYSIBM.SYSTABLES t ON c.TBCREATOR = t.CREATOR AND c.TBNAME = t.NAME AND t.TYPE IN ( 'T' )
                AND t.CREATOR IN ( 'GEG1' ) AND RTRIM(t.NAME) like '%RENL_%' ) AS Extent6 ON Extent6.Id = Extent5.ColumnId UNION ALL SELECT CAST(7 AS int) AS C1,
                Extent7.ConstraintId AS ConstraintId, Extent8.Id AS Id FROM ( SELECT CAST(NULL AS varchar(1)) AS ConstraintId ,
                CAST(NULL AS varchar(255)) AS ColumnId FROM SYSIBM.SYSDUMMY1 WHERE 1 = 2 ) AS Extent7
                INNER JOIN ( SELECT '' || '' || '' AS Id ,
                '' || '' AS ParentId , RTRIM(c.NAME) AS Name , CAST(c.COLNO AS integer) AS Ordinal ,
                CAST(CASE c.NULLS WHEN 'Y' THEN 1 WHEN 'N' THEN 0 ELSE 0 END AS smallint) AS IsNullable ,
                RTRIM(LOWER(CASE c.COLTYPE WHEN 'INTEGER' THEN 'INT' WHEN 'DOUBLE' THEN 'FLOAT' WHEN 'REAL' THEN 'FLOAT' WHEN 'TIMESTMP' THEN 'TIMESTAMP' WHEN 'CHAR'
                THEN CASE c.FOREIGNKEY WHEN 'B' THEN 'CHAR FOR BIT DATA' ELSE 'CHAR' END WHEN 'VARCHAR' THEN CASE c.FOREIGNKEY WHEN 'B' THEN 'VARCHAR FOR BIT DATA'
                ELSE 'VARCHAR' END WHEN 'LONGVAR' THEN CASE c.FOREIGNKEY WHEN 'B' THEN 'LONG VARCHAR FOR BIT DATA' ELSE 'LONG VARCHAR' END WHEN 'VARG' THEN 'VARGRAPHIC'
                WHEN 'LONGVARG' THEN 'LONG VARGRAPHIC' WHEN 'VARBIN' THEN 'VARBINARY' ELSE c.COLTYPE END)) AS TypeName , CAST(CASE c.COLTYPE WHEN 'FLOAT' THEN 8
                WHEN 'CLOB' THEN c.LENGTH2 WHEN 'BLOB' THEN c.LENGTH2 WHEN 'DBCLOB' THEN c.LENGTH2 ELSE c.LENGTH END AS integer) AS MaxLength ,
                CAST(CASE c.COLTYPE WHEN 'DECIMAL' THEN c.LENGTH WHEN 'DECFLOAT' THEN CASE c.LENGTH WHEN 8 THEN 16 WHEN 16 THEN 34 END ELSE NULL END AS integer) AS Precision ,
                CAST(CASE c.COLTYPE WHEN 'TIMESTMP' THEN 6 WHEN 'DATE' THEN 0 WHEN 'TIME' THEN 0 ELSE NULL END AS integer) AS DateTimePrecision ,
                CAST(c.SCALE AS integer) AS Scale , CAST(NULL AS varchar(128)) AS CollationCatalog , CAST(NULL AS varchar(128)) AS CollationSchema ,
                CAST(NULL AS varchar(128)) AS CollationName , CAST(NULL AS varchar(128)) AS CharacterSetCatalog ,
                CAST(NULL AS varchar(128)) AS CharacterSetSchema , CAST(NULL AS varchar(128)) AS CharacterSetName , CAST(0 AS smallint) AS IsMultiSet ,
                CAST(CASE WHEN c.DEFAULT IN ('I', 'J') THEN 1 ELSE 0 END AS smallint) AS IsIdentity ,
                CAST(CASE WHEN c.DEFAULT IN ('A', 'D') THEN 1 ELSE 0 END AS smallint) AS IsStoreGenerated , c.DEFAULTVALUE AS Default
                FROM SYSIBM.SYSCOLUMNS c INNER JOIN SYSIBM.SYSTABLES t ON c.TBCREATOR = t.CREATOR AND c.TBNAME = t.NAME AND
                t.TYPE = 'V' AND t.CREATOR IN ( 'GEG1' ) ) AS Extent8 ON Extent8.Id = Extent7.ColumnId) AS UnionAll2(C1, ConstraintId, Id) ON (CAST(7 AS int) = UnionAll2.C1)
                AND (Extent4.Id = UnionAll2.ConstraintId) WHERE Extent4.ConstraintType = 'PRIMARY KEY' ) AS Project5 ON UnionAll1.Id = Project5.C1 WHERE NOT (Extent1.Name LIKE ?) )
                AS Project6 ORDER BY Project6.SchemaName ASC, Project6.Name ASC, Project6.C2 ASC FOR FETCH ONLY
                Thanks
                • SystemAdmin
                  SystemAdmin
                  2826 Posts
                  ACCEPTED ANSWER

                  Re: Entity framework: Update Model from Database does not work

                  ‏2011-07-14T14:43:46Z  in response to MartyOne
                  Hi MartyOne,

                  the reason some of the sub-queries are using table type 'V' without the %REN_L% predicate is because these queries are pulling information for views, as well as tables, even though you only selected tables. There's nothing that we can do about this, unfortunately, as it's one of the quirks of the Miscrosoft's EF runtime. The only thing you can do, is to add a View name filter in addition to the table name filter. If you add the filter that does't match anything, it should speed up execution a little bit, as no views will be coming back, and thus no rows would be available for joins/unions ( which would increase performance ).

                  BTW, that particular query that you've posted only deals with views, thus, the actual final filtering predicate, since you haven't selected any views is WHERE NOT (Extent1.Name LIKE ?) with the parameter value being '%' to make sure nothing matches.

                  Also, since you're looking for tables that START with RENL_, I would suggest changing your filter to RENL_% instead of %RENL_%, that should give you another small performance gain, as the DB2 engine wouldn't need to search the whole table name for filter occurrence, but just compare the first 5 chars.

                  As for the timeouts, I think you might be hitting a known issue where some of our sub queries that are used by EF runtime are not applying the filtering info as they should. To verify that the fix that we have would resolve your issue, please search the queries you got from the trace and modify some of the sub-queries as follows:
                  ( you can use the following SQL formatter to quickly format the queries you've extracted to make it easier to work with http://www.dpriver.com/pp/sqlformat.htm )

                  current query:
                  
                  SELECT c.Id , c.ParentId , c.Name , c.ConstraintType , c.IsDeferrable , c.IsInitiallyDeferred FROM ( SELECT 
                  '[' || RTRIM(tc.TBCREATOR) || 
                  ']' || 
                  '[' || RTRIM(tc.TBNAME) || 
                  '_' || RTRIM(tc.CONSTNAME) || 
                  ']' AS Id , 
                  '[' || RTRIM(tc.TBCREATOR) || 
                  ']' || 
                  '[' || RTRIM(tc.TBNAME) || 
                  ']' AS ParentId ,   RTRIM(tc.CONSTNAME) AS Name ,   CAST(CASE tc.TYPE WHEN 
                  'U' THEN 
                  'UNIQUE' WHEN 
                  'P' THEN 
                  'PRIMARY KEY' END AS varchar(11)) AS ConstraintType ,   CAST(0 AS smallint) AS IsDeferrable ,   CAST(0 AS smallint) AS IsInitiallyDeferred FROM SYSIBM.SYSTABCONST tc   UNION ALL SELECT 
                  '[' || RTRIM(rc.CREATOR) || 
                  ']' || 
                  '[' || RTRIM(rc.TBNAME) || 
                  '_' || RTRIM(rc.RELNAME) || 
                  ']' AS Id , 
                  '[' || RTRIM(rc.CREATOR) || 
                  ']' || 
                  '[' || RTRIM(rc.TBNAME) || 
                  ']' AS ParentId ,   RTRIM(rc.RELNAME) AS Name ,   CAST(
                  'FOREIGN KEY' AS varchar(11)) AS ConstraintType ,   CAST(CASE rc.CHECKEXISTINGDATA WHEN 
                  'I' THEN 0 ELSE 1 END AS smallint) AS IsDeferrable ,   CAST(CASE rc.CHECKEXISTINGDATA WHEN 
                  'N' THEN 1 ELSE 0 END AS smallint) AS IsInitiallyDeferred FROM SYSIBM.SYSRELS rc   ) AS c (Id, ParentId, Name, ConstraintType, IsDeferrable, IsInitiallyDeferred)
                  


                  new query:
                  
                  SELECT c.Id , c.ParentId , c.Name , c.ConstraintType , c.IsDeferrable , c.IsInitiallyDeferred FROM ( SELECT 
                  '[' || RTRIM(tc.TBCREATOR) || 
                  ']' || 
                  '[' || RTRIM(tc.TBNAME) || 
                  '_' || RTRIM(tc.CONSTNAME) || 
                  ']' AS Id , 
                  '[' || RTRIM(tc.TBCREATOR) || 
                  ']' || 
                  '[' || RTRIM(tc.TBNAME) || 
                  ']' AS ParentId ,   RTRIM(tc.CONSTNAME) AS Name ,   CAST(CASE tc.TYPE WHEN 
                  'U' THEN 
                  'UNIQUE' WHEN 
                  'P' THEN 
                  'PRIMARY KEY' END AS varchar(11)) AS ConstraintType ,   CAST(0 AS smallint) AS IsDeferrable ,   CAST(0 AS smallint) AS IsInitiallyDeferred FROM SYSIBM.SYSTABCONST tc WHERE tc.TBCREATOR IN (
                  'GEG1') AND tc.TBNAME LIKE 
                  'RENL_%'   UNION ALL SELECT 
                  '[' || RTRIM(rc.CREATOR) || 
                  ']' || 
                  '[' || RTRIM(rc.TBNAME) || 
                  '_' || RTRIM(rc.RELNAME) || 
                  ']' AS Id , 
                  '[' || RTRIM(rc.CREATOR) || 
                  ']' || 
                  '[' || RTRIM(rc.TBNAME) || 
                  ']' AS ParentId , RTRIM(rc.RELNAME) AS Name ,   CAST(
                  'FOREIGN KEY' AS varchar(11)) AS ConstraintType ,   CAST(CASE rc.CHECKEXISTINGDATA WHEN 
                  'I' THEN 0 ELSE 1 END AS smallint) AS IsDeferrable ,   CAST(CASE rc.CHECKEXISTINGDATA WHEN 
                  'N' THEN 1 ELSE 0 END AS smallint) AS IsInitiallyDeferred FROM SYSIBM.SYSRELS rc WHERE rc.CREATOR IN (
                  'GEG1') AND rc.TBNAME LIKE 
                  'RENL_%'   ) AS c (Id, ParentId, Name, ConstraintType, IsDeferrable, IsInitiallyDeferred)
                  


                  current query:
                  
                  SELECT 
                  '[' || RTRIM(cc.CREATOR) || 
                  ']' || 
                  '[' || RTRIM(TBNAME) || 
                  '_' || RTRIM(cc.CHECKNAME) || 
                  ']' AS Id , cc.CHECKCONDITION AS Expression FROM SYSIBM.SYSCHECKS cc
                  


                  new query:
                  
                  SELECT 
                  '[' || RTRIM(cc.CREATOR) || 
                  ']' || 
                  '[' || RTRIM(TBNAME) || 
                  '_' || RTRIM(cc.CHECKNAME) || 
                  ']' AS Id , cc.CHECKCONDITION AS Expression FROM SYSIBM.SYSCHECKS cc WHERE cc.CREATOR IN (
                  'GEG1') AND TBNAME LIKE 
                  'RENL_%'
                  


                  current query:
                  
                  SELECT 
                  '[' || RTRIM(TBCREATOR) || 
                  ']' || 
                  '[' || RTRIM(TBNAME) || 
                  '_' || RTRIM(CONSTNAME) || 
                  ']' AS ConstraintId ,   
                  '[' || RTRIM(TBCREATOR) || 
                  ']' || 
                  '[' || RTRIM(TBNAME) || 
                  ']' || 
                  '[' || RTRIM(COLNAME) || 
                  ']' AS ColumnId FROM SYSIBM.SYSKEYCOLUSE
                  


                  new query:
                  
                  SELECT 
                  '[' || RTRIM(TBCREATOR) || 
                  ']' || 
                  '[' || RTRIM(TBNAME) || 
                  '_' || RTRIM(CONSTNAME) || 
                  ']' AS ConstraintId ,   
                  '[' || RTRIM(TBCREATOR)    || 
                  ']' || 
                  '[' || RTRIM(TBNAME) || 
                  ']' || 
                  '[' || RTRIM(COLNAME) || 
                  ']' AS ColumnId FROM SYSIBM.SYSKEYCOLUSE WHERE RTRIM(TBCREATOR) IN (
                  'GEG1') AND TBNAME LIKE 
                  'RENL_%'
                  


                  current query:
                  
                  SELECT 
                  '[' || RTRIM(rc.CREATOR) || 
                  ']' || 
                  '[' || RTRIM(TBNAME) || 
                  '_' || RTRIM(rc.RELNAME) || 
                  ']' AS Id , CAST(
                  'SET DEFAULT' AS varchar(11)) AS UpdateRule , CAST(CASE rc.DELETERULE WHEN 
                  'A' THEN 
                  'NO ACTION' WHEN 
                  'C' THEN 
                  'CASCADE' WHEN 
                  'N' THEN 
                  'SET NULL' WHEN 
                  'R' THEN 
                  'SET DEFAULT' ELSE 
                  'SET DEFAULT' END AS varchar(11)) AS DeleteRule FROM SYSIBM.SYSRELS rc
                  


                  new query:
                  
                  SELECT 
                  '[' || RTRIM(rc.CREATOR) || 
                  ']' || 
                  '[' || RTRIM(TBNAME) || 
                  '_' || RTRIM(rc.RELNAME) || 
                  ']' AS Id , CAST(
                  'SET DEFAULT' AS varchar(11)) AS UpdateRule , CAST(CASE rc.DELETERULE WHEN 
                  'A' THEN 
                  'NO ACTION' WHEN 
                  'C' THEN 
                  'CASCADE' WHEN 
                  'N' THEN 
                  'SET NULL' WHEN 
                  'R' THEN 
                  'SET DEFAULT' ELSE 
                  'SET DEFAULT' END AS varchar(11)) AS DeleteRule FROM SYSIBM.SYSRELS rc WHERE RTRIM(rc.CREATOR) IN (
                  'GEG1') AND TBNAME LIKE 
                  'RENL_%'
                  


                  current query:
                  
                  SELECT 
                  '[' || RTRIM(FC.CREATOR) || 
                  ']' || 
                  '[' || RTRIM(FC.TBNAME) || 
                  '_' || RTRIM(FC.RELNAME) || 
                  ']'  || 
                  '[' || CAST(RTRIM(CAST(FC.COLSEQ AS 
                  
                  char(30))) AS varchar(30)) || 
                  ']' AS Id ,   
                  '[' || RTRIM(PC.TBCREATOR)  || 
                  ']' || 
                  '[' || RTRIM(PC.TBNAME)   || 
                  ']' || 
                  '[' || RTRIM(PC.COLNAME) || 
                  ']' AS ToColumnId ,   
                  '[' || RTRIM(FC.CREATOR)    || 
                  ']' || 
                  '[' || RTRIM(FC.TBNAME)   || 
                  ']' || 
                  '[' || RTRIM(FC.COLNAME) || 
                  ']' AS FromColumnId ,   
                  '[' || RTRIM(FC.CREATOR)    || 
                  ']' || 
                  '[' || RTRIM(FC.TBNAME) || 
                  '_' || RTRIM(FC.RELNAME)  || 
                  ']' AS ConstraintId ,   CAST(FC.COLSEQ AS 
                  
                  int) AS Ordinal FROM SYSIBM.SYSRELS AS RC INNER JOIN SYSIBM.SYSKEYCOLUSE AS PC ON       RC.REFTBCREATOR = PC.TBCREATOR AND      RC.REFTBNAME    = PC.TBNAME INNER JOIN SYSIBM.SYSFOREIGNKEYS AS FC ON       RC.CREATOR = FC.CREATOR AND      RC.TBNAME  = FC.TBNAME AND      RC.RELNAME = FC.RELNAME AND      PC.COLSEQ  = FC.COLSEQ
                  


                  new query:
                  
                  SELECT 
                  '[' || RTRIM(FC.CREATOR) || 
                  ']' || 
                  '[' || RTRIM(FC.TBNAME) || 
                  '_' || RTRIM(FC.RELNAME) || 
                  ']'  || 
                  '[' || CAST(RTRIM(CAST(FC.COLSEQ AS 
                  
                  char(30))) AS varchar(30)) || 
                  ']' AS Id ,   
                  '[' || RTRIM(PC.TBCREATOR)  || 
                  ']' || 
                  '[' || RTRIM(PC.TBNAME)   || 
                  ']' || 
                  '[' || RTRIM(PC.COLNAME) || 
                  ']' AS ToColumnId ,   
                  '[' || RTRIM(FC.CREATOR)    || 
                  ']' || 
                  '[' || RTRIM(FC.TBNAME)   || 
                  ']' || 
                  '[' || RTRIM(FC.COLNAME) || 
                  ']' AS FromColumnId ,   
                  '[' || RTRIM(FC.CREATOR)    || 
                  ']' || 
                  '[' || RTRIM(FC.TBNAME) || 
                  '_' || RTRIM(FC.RELNAME)  || 
                  ']' AS ConstraintId ,   CAST(FC.COLSEQ AS 
                  
                  int) AS Ordinal FROM SYSIBM.SYSRELS AS RC INNER JOIN SYSIBM.SYSKEYCOLUSE AS PC ON       RC.REFTBCREATOR = PC.TBCREATOR AND      RC.REFTBNAME    = PC.TBNAME AND  RC.REFTBCREATOR IN (
                  'GEG1') AND RC.REFTBNAME LIKE 
                  'RENL_%' INNER JOIN SYSIBM.SYSFOREIGNKEYS AS FC ON       RC.CREATOR = FC.CREATOR AND      RC.TBNAME  = FC.TBNAME AND      RC.RELNAME = FC.RELNAME AND      PC.COLSEQ  = FC.COLSEQ AND  RC.CREATOR IN (
                  'GEG1') AND RC.TBNAME LIKE 
                  'RENL_%'
                  


                  Regards,
                  Alex
                  • MartyOne
                    MartyOne
                    14 Posts
                    ACCEPTED ANSWER

                    Re: Entity framework: Update Model from Database does not work

                    ‏2011-07-14T15:08:16Z  in response to SystemAdmin
                    Thanks Alex, let me try this. When yo usay fix you mean the test here by filtering here by schema and table filters.
                    Do you anticipate that a FP5 might include this or a special .dll that I can try to keep moving? Just asking because our back
                    up plan is to import the tables into SQL Server, fix a bunch of datatypes and then generate a POCO model from that. I'm an architect at Cigna and we're on tight deadlines to move forward but I am hoping that I can push through this because we really want to do round-trip engineering against db2 from vs 2010.
                    thanks - let me try those queries soon.
                    Marty
                    • SystemAdmin
                      SystemAdmin
                      2826 Posts
                      ACCEPTED ANSWER

                      Re: Entity framework: Update Model from Database does not work

                      ‏2011-07-14T16:09:37Z  in response to MartyOne
                      Hi Marty,

                      our next release will definitely include the filtering fix. However, if you require the fix sooner, you can go through the regular IBM tech support to open a service request to get the fix. If you post the request number here, I can push from my end to get it through to development to get the fix out to you.

                      Regards,
                      Alex
                      • MartyOne
                        MartyOne
                        14 Posts
                        ACCEPTED ANSWER

                        Re: Entity framework: Update Model from Database does not work

                        ‏2011-07-15T18:09:05Z  in response to SystemAdmin
                        Hi Alex, thanks very much! I appreciate the help and quick responses. Working with others on my team at Cigna and passing on good word from you.

                        We will not go through formal process for now because that would be our Enteprise Group. However, if you want to include me on test distribution for a .DLL for any add-in fixes, I would be happy to test. I would think that would help a lot of developers going against DB2 from .NET. I could test out the fix and also we might see other errors so you would have a good testing person and we could not need to wait until say FP6 just in case. For now, we have manually created POCO object and today I successfully use EF 4.1 Code First to DB2 zOS to get an Entity Set DbSet<T> back from the server. Whew.

                        thanks for your help - Any idea if we could test an Add-In for you and/or when these changes would be ready for download?
                        Marty Spallone
                        • SystemAdmin
                          SystemAdmin
                          2826 Posts
                          ACCEPTED ANSWER

                          Re: Entity framework: Update Model from Database does not work

                          ‏2011-07-21T18:56:02Z  in response to MartyOne
                          Hi Marty,

                          while we do not pre-announce our deliverables, you can look at the past, where we have released code refreshes about every 6 months, our last release was V9.7 FP4 in April - thus you can approximate the next release date :).
                          As for testing the DLLs, I appreciate you volunteering, however, as far as I know we're not planning to run any customer beta sessions for the next release.

                          Thanks,
                          Alex
                          • vikrantislav
                            vikrantislav
                            20 Posts
                            ACCEPTED ANSWER

                            Re: Entity framework: Update Model from Database does not work

                            ‏2011-08-09T19:39:16Z  in response to SystemAdmin
                            Hi Alex, just wondering if you had any thoughts or comments on my post above that this could be caused by having multiple stored procs with the same name?

                            Thanks.
                            • SystemAdmin
                              SystemAdmin
                              2826 Posts
                              ACCEPTED ANSWER

                              Re: Entity framework: Update Model from Database does not work

                              ‏2011-08-09T19:53:21Z  in response to vikrantislav
                              Hi vikrantislav,

                              we're currently looking into how we can support this. Unfortunately, the solution to this issue is not simple. The SQL Server syntax doesn't support overloaded SP definition, and, thus, the EF runtime that they built doesn't support it either. Thus, it expects the SCHEMA+SPNAME combination to be unique. We also can't simply change the SP names to be unique in our queries, because then they would not be callable. We will work with microsoft to see how we can resolve this.

                              Regards,
                              Alex
                              • vikrantislav
                                vikrantislav
                                20 Posts
                                ACCEPTED ANSWER

                                Re: Entity framework: Update Model from Database does not work

                                ‏2011-08-09T20:38:15Z  in response to SystemAdmin
                                Alex,

                                Great! Thanks for the updated communication.
  • u234jaslfj
    u234jaslfj
    2 Posts
    ACCEPTED ANSWER

    Re: Entity framework: Update Model from Database does not work

    ‏2012-08-22T19:59:38Z  in response to calinarens
    The following may be causing your issue if it isn't caused by overloaded stored procedures.

    It appears that you have to have a db2 data connection set up that matches what is in your App.config. It must have the same db2 client server as well, so the db2 client server must be in the connection string (you can't just use cataloging). If you change the data connection or connection string it appears to break the functionality where you right click on a table and select ‘Update Model from Database…’ The error I was getting was: Error retrieving database information. Error message: ‘An item with the same key has already been added.’

    I also found out that you can change the db2 client server in both the data connection and the connection string, but you have to then recompile the EF project.

    I am using version 10.1 of the DB2 Client and Visual Studio Tools.

    Hope this helps someone.