+1  A: 

I'm not familiar with the library or function, but the error message implies that you are passing a function as a parameter where an Int32 is expected. And in fact you are passing a lambda function (the "=>") as the parameter to Destroy. So the first thing to check is if Destroy really wants a function, or an Integer.

If that's not it, note that the lambda function is retuning a bool (the result of a == comparison), but the error implies that an Int32 is wanted. You might have to convert your bool to int, which you could easily do with the ?: operator like this:

x => ((x.TestId == _testId) ? 1 : 0)

But of course, both answers depend on what the Destroy parameter is actually expecting.

Andy Jacobs
+1  A: 

Hi VillageIdiot, it looks like a proper bug, as the SubSonicRepository on which the ActiveRecord Destroy method depends doesn't have a Delete(expression) overload.

I think if you go into your ActiveRecord.tt template file and find:

    public static void Destroy(Func<<#=tbl.ClassName#>, bool> expression) {
        var repo = GetRepo();
        repo.Delete(expression);
    }

and replace Delete with DeleteMany that will delete all the records returning true for the given expression (hopefully just the one if you're using the primary key :)

GC

GC
looks promising. I'll try it.
TheVillageIdiot
I've logged an issue in the Templates project on GitHub.
GC