Search code examples
entity-framework-4entity-framework-designer

Adding tables to Entity Framework model results in RPC "too many parameters" error


When updating an EDMX model from the designer to add tables on a large database, an error is returned in the output window:

Unable to generate the model because of the following exception: 'An error occurred while executing the command definition. See the inner exception for details.

The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Too many parameters were provided in this RPC request. The maximum is 2100. '. Loading metadata from the database took 00:00:04.5149496. Generating the model took 00:00:14.0108568. Unable to generate the model because of the following exception: 'An error occurred while executing the command definition. See the inner exception for details.

The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream incorrect. Too many parameters were provided in this RPC request. The maximum is 2100. '. Loading metadata from the database took 00:00:04.2847682. Generating the model took 00:00:06.1297751.

How can this problem be worked around/resolved?


Solution

  • According to Microsoft support, this is the result of a design limitation in how the designer differences the list of tables already in the model and the list of tables in the database.

    There are three main options to work around the problem:

    1. Create a database user which has permission to see only the tables that are necessary for the model.

      The disadvantages of this option are that the user's rights must be maintained the model is maintained (e.g., for each table added to the model, the "model maintenance user" must be granted rights to see the table) (note, after changing user in connectionconfiguration, may be necessary to exit designer and/or VS for it to take effect)

    2. Split the EDMX into multiple, smaller models

      This can improve performance in some cases on large models, but the boundaries must be selected carefully to avoid problems with selecting from tables across models.

    3. Remove tables from the model

      Generally, this is only an option of there are contextually unnecessary tables already in the model.