Permalink
Browse files

added better error message for a request to instantiate an abstract c…

…lass.
  • Loading branch information...
1 parent e543727 commit 23b6289661ff46466f8f4eb2db108d9fa46b437f @craiggwilson craiggwilson committed Aug 9, 2010
Showing with 3 additions and 0 deletions.
  1. +3 −0 source/MongoDB/Configuration/Mapping/Model/ClassMapBase.cs
@@ -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);

0 comments on commit 23b6289

Please sign in to comment.