There should be a place in code where the type gets known.
There isn't! The type is just a string passed to the datasource. It comes out of the database and is never examined.
string factoryTypeName =
string.Concat("JGSR.BFWeekender.DataAccessServices.FactoryClasses.", TypeName,
"EntityFactory, JGSR.BFWeekender.DataAccessServices");
llblGenDataSource.EntityFactoryTypeName = factoryTypeName;
I could add an additional column in the db to store the pk field but it seems a waste when this information is embedded in the LLBLGen generated code.