In the generated code, under the Factory Classes, there is a class GeneralEntityFactory where you can use its create method to create your entity based on the type.
public static IEntity2 Create(EntityType entityTypeToCreate)
{
IEntityFactory2 factoryToUse = null;
switch(entityTypeToCreate)
{
case POT.EntityType.ActivityEntity:
factoryToUse = new ActivityEntityFactory();
break;
case POT.EntityType.ClientEntity:
factoryToUse = new ClientEntityFactory();
break;
}
return factoryToUse.Create();
}
Although I find it useless, but you can modify the templates to generate another similar method that only returns the factoryToUse without creating the entity.