Search code examples
subsonicexecutereader

SubSonic InlineQuery returning wrong results with ExecuteAsCollection


Using SubSonic 2.2, I have this query:

string q = @"SELECT Media.Id, Media.Title FROM Media WHERE Media.UserId = 7"
DAL.MediumCollection matches = new InlineQuery().ExecuteAsCollection<DAL.MediumCollection>(q).Load();

Looping through "matches" results in every single entry in the "Media" table.

However, when I do this:

IDataReader reader = new InlineQuery().ExecuteReader(q);

It returns the correct rows. Why is ExecuteAsCollection returning something completely different from ExecuteReader? Has anyone else experience this strange behavior?


Solution

  • I think it's because you're calling .Load(). That's overwriting your original query.