Using ObjectParameter on an Entity SQL query against the Entity Framework
I am writing this module to dynamically create Entity SQL query which go against the Entity Framework. To prevent SQL injection, instead of directly concatenating the string I am passing the values for the where clause using the array of ObjectParameter[]. Since I am dynamically creating the Parameter array in order to create a unique parameter key for every value I used the logic to concatenate the field names and add an integer to it. So if the field was City, the parameter key would be "City1" If the field was Address.Phone.HomePhoneNumber, the parameter key would be "AddressPhoneHomePhoneNumber1". The key doesn't allow dpts ".", so have to remove them too. On one such query I found out that I kept getting an error every time I executed it. The error was the generic ListDictionary error: "System.ArgumentException : An item with the same key has already been added" I confirmed and re-confirmed that the parameters I was adding ...










