Refactored Base classes for datatype and entity