The Developer's Guide has some great information about how to implement Dynamics Entities. Have you read through that already? Also, one of the tech tips might shed some light on what you want to do:
http://www.ideablade.com/techtip_Dynamic_Entity_Types.htm. In addition, there are a couple of sample solutions in the program installation folder. You will find them in the instructional units folder within the 300 Advanced section.
Happy code reviewing and reading!
Bill