To repro, point LINQPad at an existing DB connection and run a query, then modify the query and run again, this time it will fail with this exception:
'Value' is not a member of type 'UserQuery+Test' (Parameter 'bindings[0]')
You can press SHIFT+F5 to wipe the app domain and run it again, this time it will succeed. That shouldn't be necessary. Dapper for example has no issue with successive runs in the same app domain. For users of LINQPad (a very popular app), this is kind of a deal breaker for RepoDB vs. Dapper though, as clearing the app domain is a pain as it resets all the caches, etc.
Simple repro follows. Execute the SQL to create a simple table and populate it, then run the c# code in LINQPad. After the first run, change the 1 value to 2, and run again, this time it will throw.
SQL setup:
CREATE TABLE Test (
Value INT NOT NULL
)
go
INSERT INTO Test VALUES (1)
INSERT INTO Test VALUES (2)
Code:
void Main()
{
string connectionString = this.Connection.ConnectionString;
if (!RepoDb.SqlServerBootstrap.IsInitialized) RepoDb.SqlServerBootstrap.Initialize();
using (var connection = new Microsoft.Data.SqlClient.SqlConnection(connectionString).EnsureOpen())
{
connection.Query<Test>(a => a.Value == 1).First().Dump();
}
}
public class Test
{
public int Value { get; set; }
}
You are correct, I can as well replicate the problem in the Linqpad.
First execution:

Second execution:
It is failing after I made a change.

Let me check of this, but it seems not related to caching. Looks like related to the type system reflection before RepoDB compilation happens. I am pretty sure, such problem is triggered by the compiler.
EDIT: Just realized that it could be caching related as well. RepoDB does cache everything once generated, specifically the compiled expressions, and it seems the old compiled expression is still being used.
Note: The fix could be, use the Type.GetHashCode() as the caching key instead of the Type.FullName.
@palenshus - I made some updates that fixes atleast using the actual DLL referenced to my local LinqPad. Can you test this one with the latest beta release RepoDb v1.12.0-beta3?
Hmm, still getting an error. Do I need an updated RepoDb.SqlServer too?

Thank you for testing, me trace this one again tomorrow.
This will be fixed on the next version release, either beta or actual release. The underlying problem is the caching of the hash code for the .NET CLR Types. The result of the GetHashCode() method is changing for the .NET CLR Custom Types, but not for the String.

Notice the highlighted item below. It is the one that is changing.

Interesting, nice sleuthing, looking forward to the fix, thanks Mike!
On Fri, Sep 11, 2020 at 1:37 AM Michael Camara Pendon <
[email protected]> wrote:
This will be fixed on the next version release, either beta or actual
release. The underlying problem is the caching of the hash code for the
.NET CLR Types. The result of the GetHashCode() method is changing for
the .NET CLR Custom Types, but not for the String.[image: image]
https://user-images.githubusercontent.com/591015/92893976-7b1c4a00-f41a-11ea-9801-4caf3e47a49b.pngNotice the highlighted item below. It is the one that is changing.
[image: image]
https://user-images.githubusercontent.com/591015/92894221-b0289c80-f41a-11ea-9f8b-42e85d2750ba.png—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/mikependon/RepoDb/issues/543#issuecomment-690958229,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AB4KUCDTCDICDCBZ3VFV4GTSFHOVXANCNFSM4QW3DDYQ
.
The fix is now available at RepoDb v1.12.0-beta4 and RepoDb.SqlServer v1.1.0-beta2.
> Install-Package RepoDb -version 1.12.0-beta4
> Install-Package RepoDb.SqlServer -version 1.1.0-beta2
Working now, thanks Michael!
On Thu, Sep 17, 2020 at 1:34 PM Michael Camara Pendon <
[email protected]> wrote:
The fix is now available at RepoDb v1.12.0-beta4
https://www.nuget.org/packages/RepoDb/1.12.0-beta4 and RepoDb.SqlServer
v1.1.0-beta2 https://www.nuget.org/packages/RepoDb.SqlServer/1.1.0-beta2
.Install-Package RepoDb -version 1.12.0-beta4> Install-Package RepoDb.SqlServer -version 1.1.0-beta2
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/mikependon/RepoDb/issues/543#issuecomment-694484970,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AB4KUCH3FRMG5OEUZEWT3PDSGJXFRANCNFSM4QW3DDYQ
.
Thanks for the verification.