Whenever the code attempts to insert a row into the database, it is hitting an error trying to retrieve any database generated values when it tries to update the entity object. The error is being hit within System.Data.Metadata.Edm.MemberCollection (http://referencesource.microsoft.com/#S ... lection.cs) but is directly related to the effects of the workaround mentioned above. The insert query generated by DotConnect (with that workaround set to true) looks like the following:
Code: Select all
/*Note: the "Data" and "Id" columns are not quoted and are capitalized the same way the properties are in the entity object i.e. standard c# Pascal casing (http://c2.com/cgi/wiki?PascalCase)*/
INSERT INTO public.identitytest(Data)
VALUES ('New Data')
RETURNING Id
The current workaround for this issue is to just rename all database generated entity columns to all lowercase, however this renaming is what we are trying to avoid by using "DisableQuoting" in the first place.
I believe the issue can be resolved by modifying the code that generates the returning statement to add an 'AS "[PROPERTY_NAME]"' after each returned value. So the SQL above would be changed to:
Code: Select all
INSERT INTO public.identitytest(Data)
VALUES ('New Data')
RETURNING Id AS "Id"
It would be greatly appreciated if this issue could be addressed.
I have a small program that shows this issue in action if needed.