querybuilder icon indicating copy to clipboard operation
querybuilder copied to clipboard

How to deal with C# records' EqualityContract property?

Open zelenij opened this issue 2 years ago • 1 comments

I have a simple C# record, which I want to insert into the database using InsertAsync<> method of SqlKata. The insert fails with the following exception:

 The member p0 of type System.RuntimeType cannot be used as a parameter value

I guess it is caused by the auto-generated EqualityContract property on the record. Is there a workaround for this in SqlKata? I'd rather not fall back to hand-written SQL statements yet.

zelenij avatar May 17 '22 13:05 zelenij

Since "EqualityContract" has a type of "Type", should Query just ignore some types internally?

https://github.com/sqlkata/querybuilder/blob/064adccabd4e9d9dd54fa7dbd9e609610e10730e/QueryBuilder/Query.cs#L400-L411

rtao avatar Aug 09 '22 03:08 rtao