You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.7 KiB
45 lines
1.7 KiB
// Author: Simon Gockner
|
|
// Created: 2020-09-18
|
|
// Copyright(c) 2020 SimonG. All Rights Reserved.
|
|
|
|
using System;
|
|
using GBase.FileHandling.Factories;
|
|
using GBase.Interfaces;
|
|
using GBase.Interfaces.DataHandling.Pool;
|
|
using GBase.Interfaces.FileHandling;
|
|
|
|
namespace GBase.Factories
|
|
{
|
|
/// <summary>
|
|
/// Factory for the <see cref="IGBaseTable"/>
|
|
/// </summary>
|
|
public class GBaseTableFactory : IGBaseTableFactory
|
|
{
|
|
private readonly IFileHandlerFactory _fileHandlerFactory;
|
|
private readonly IDataHandlerPool _dataHandlerPool;
|
|
private readonly IGBaseColumnFactory _gBaseColumnFactory;
|
|
|
|
/// <summary>
|
|
/// Factory for the <see cref="IGBaseTable"/>
|
|
/// </summary>
|
|
/// <param name="fileHandlerFactory">Factory for the <see cref="IFileHandler"/></param>
|
|
/// <param name="dataHandlerPool"></param>
|
|
/// <param name="gBaseColumnFactory">Factory for the <see cref="IGBaseColumn"/></param>
|
|
public GBaseTableFactory(IFileHandlerFactory fileHandlerFactory, IDataHandlerPool dataHandlerPool, IGBaseColumnFactory gBaseColumnFactory)
|
|
{
|
|
_fileHandlerFactory = fileHandlerFactory;
|
|
_dataHandlerPool = dataHandlerPool;
|
|
_gBaseColumnFactory = gBaseColumnFactory;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Creates an <see cref="IGBaseTable"/>
|
|
/// </summary>
|
|
/// <returns>A newly created instance of the implementation for <see cref="IGBaseTable"/></returns>
|
|
public IGBaseTable Create(Type type)
|
|
{
|
|
Type gBaseTableType = typeof(GBaseTable<>).MakeGenericType(type);
|
|
return (IGBaseTable) Activator.CreateInstance(gBaseTableType, _fileHandlerFactory, _dataHandlerPool, _gBaseColumnFactory);
|
|
}
|
|
}
|
|
} |