Too many parameters were provided in this RPC request. The maximum is 2100

Sep 25, 2013 at 9:16 PM
Edited Sep 25, 2013 at 9:17 PM
I can see that there is an open Issue on this (https://fluentdata.codeplex.com/workitem/1753), but I cannot figure out how to work around this problem.

The problem:
imageOverride.ID = this.context.Insert("ImageOverrides")
                                    .Column("ID", imageOverride.ID)
                                    .Column("TenantID", imageOverride.TenantID)
                                    .Column("ImageOverrideDefinitionID", imageOverride.ImageOverrideDefinition.ID)
                                    .Column("Image", imageOverride.Image)
                                    .ExecuteReturnLastId<int>();
imageOverride.Image is a byte array (byte[]).
I want to store that array into a column in my DB.
But FluentData, probably due to ReflectionHelper.IsList(value) returning true for a byte array, is calling DbCommand.AddListParameterToInnerCommand() rather than DbCommand.AddParameterToInnerCommand().
Is there any way to force FluentData to see the byte array as a single item to put into 1 column in my DB?
I just moved off NHibernate to FluentData (because I hate NHibernate), and I really don't want to have to go back, but if there is no workaround for this, I will have to undo all the work that I have done...
Coordinator
Sep 25, 2013 at 10:19 PM
This should hopefully be fixed now. Can you grab the latest source code, compile and see if its working for you now?


Lars-Erik
Sep 25, 2013 at 10:23 PM
Ok. I found a workaround.
            string thisIsDumb = "0x" + BitConverter.ToString(imageOverride.Image).Replace("-", string.Empty);

            imageOverride.ID = this.context.Sql("insert into ImageOverrides (TenantID, ImageOverrideDefinitionID, Image) values ('" 
                            + imageOverride.TenantID + "', '" +
                             imageOverride.ImageOverrideDefinition.ID + "', " + thisIsDumb + ")").ExecuteReturnLastId<int>();
I really want to use parameters, but at least I don't have to go back to NHibernate.
Coordinator
Sep 25, 2013 at 10:27 PM
Well if you take the latest then your first code example should work:
imageOverride.ID = this.context.Insert("ImageOverrides")
                                .Column("ID", imageOverride.ID)
                                .Column("TenantID", imageOverride.TenantID)
                                .Column("ImageOverrideDefinitionID", imageOverride.ImageOverrideDefinition.ID)
                                .Column("Image", imageOverride.Image)
                                .ExecuteReturnLastId<int>();
Optionally if you aren't able to get a latest and compile then I can build the dll...
Sep 25, 2013 at 10:37 PM
Sorry, I didn't see your response before I posted the workaround.
I'll download the latest and post back with my results.
Sep 30, 2013 at 8:31 PM
I'm happy to report that downloading the latest code fixes the problem I was having. :)
Mar 12, 2014 at 1:00 AM
I am having the same issue. I downloaded the code and rebuilt it and it is still giving the same error. Any ideas?