SamSaffron/dapper-dot-net — pull request #75 by ctstone (2013-02-03 20:32:57+00:00)
Title: Table reflection does not work for table with Id that is not int

The problem originated from trying to use Activator on typeof(Table<>) instead of typeof(Table<,>) e.g. for Table.

However, since table construction is handled the same for all tables in a database, I pulled the Table Id generic typing from the Table class and put it into the Database class. The idea is to specify Id typing once in the Database instead of in each Table.

I also added a Database implementation that assumes Id=typeof(int) to prevent breaking existing usage. I don't think Table was working with non-int Ids before this, so these changes should not negatively affect that use case.

Maybe the ideal situation would be to examine each Table property in the Database, and use Activator directly on its GetType().GetGenericTypeDefinition(). Though this might be a bit of an overhaul and might affect performance.

DapperTests all passed, and I successfully tested Tables of type int and Guid. Hope this is helpful.