Skip to content

Commit

Permalink
added better error message for a request to instantiate an abstract c…
Browse files Browse the repository at this point in the history
…lass.
  • Loading branch information
craiggwilson committed Aug 9, 2010
1 parent e543727 commit 23b6289
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions source/MongoDB/Configuration/Mapping/Model/ClassMapBase.cs
Expand Up @@ -145,6 +145,9 @@ public object CreateInstance()
if(!_hasProtectedOrPublicConstructor)
throw new MissingMethodException("No public or protected constructor found on type " + ClassType.FullName);

if (ClassType.IsAbstract)
throw new MongoException("Unable to create an instance of an abstract class.");

//TODO: figure out how to support custom activators...
var instance = Activator.CreateInstance(ClassType, true);

Expand Down

0 comments on commit 23b6289

Please sign in to comment.