Fixes for data source juggler

/to @ritch 

Move resolveType to ModelBuilder
 
Make sure model definition is built when attaching to a DS:
The problem is found when a model class is re-attached to a different DS during test.