markrendle / Simple.Data

A light-weight, dynamic data access component for C# 4.0
MIT License
1.33k stars 303 forks source link

< clause throws ArgumentException when using InMemoryAdapter #305

Open AwaNoodle opened 11 years ago

AwaNoodle commented 11 years ago

Hi,

When using the InMemoryAdapter populated with some records, an expression I'm using that contains a < operator on two fields of the table is throwing an ArgumentException saying "Object must be of type XXX". This is happened whichever type I am populating the table with. The expression works in live when connected to SQL Server.

Example:

var adapter = new InMemoryAdapter();
Database.UseMockAdapter(adapter);
var db = Database.Open();
db.TestDb.Insert(ExternalOrderStatusId: 10, InternalOrderStatusId: 20);

var database = Database.Open();
var records = database.TestDb.GetCount(database.TestDb.ExternalOrderStatusId < database.TestDb.InternalOrderStatusId); // Throws here

Console.WriteLine("Found {0} records", records);
Console.ReadKey();