diff --git a/GBase/Factories/GBaseTableFactory.cs b/GBase/Factories/GBaseTableFactory.cs index d20772d..73b9507 100644 --- a/GBase/Factories/GBaseTableFactory.cs +++ b/GBase/Factories/GBaseTableFactory.cs @@ -3,6 +3,7 @@ // Copyright(c) 2020 SimonG. All Rights Reserved. using System; +using GBase.Exceptions; using GBase.FileHandling.Factories; using GBase.Interfaces; using GBase.Interfaces.DataHandling.Pool; @@ -38,6 +39,9 @@ namespace GBase.Factories /// A newly created instance of the implementation for public IGBaseTable Create(Type type) { + if (!typeof(IGBaseObject).IsAssignableFrom(type)) + throw new InvalidTableTypeException(type); + Type gBaseTableType = typeof(GBaseTable<>).MakeGenericType(type); return (IGBaseTable) Activator.CreateInstance(gBaseTableType, _fileHandlerFactory, _dataHandlerPool, _gBaseColumnFactory); }