- add first init of entries to table.init

pull/26/head
Simon Gockner 6 years ago
parent 0d8e22293e
commit 889fe92716
  1. 2
      GBase/GBase.xml
  2. 16
      GBase/GBaseTable.cs

@ -500,7 +500,7 @@
A <see cref="T:GBase.Interfaces.IGBase"/> table A <see cref="T:GBase.Interfaces.IGBase"/> table
</summary> </summary>
</member> </member>
<member name="M:GBase.GBaseTable.#ctor(GBase.FileHandling.Factories.IFileHandlerFactory)"> <member name="M:GBase.GBaseTable.#ctor(GBase.FileHandling.Factories.IFileHandlerFactory,GBase.Factories.IGBaseEntryFactory)">
<summary> <summary>
A <see cref="T:GBase.Interfaces.IGBase"/> table A <see cref="T:GBase.Interfaces.IGBase"/> table
</summary> </summary>

@ -5,8 +5,11 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Reflection;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using GBase.Attributes;
using GBase.Factories;
using GBase.FileHandling.Factories; using GBase.FileHandling.Factories;
using GBase.Interfaces; using GBase.Interfaces;
using GBase.Interfaces.FileHandling; using GBase.Interfaces.FileHandling;
@ -19,13 +22,15 @@ namespace GBase
public class GBaseTable : IGBaseTable public class GBaseTable : IGBaseTable
{ {
private readonly IFileHandler _fileHandler; private readonly IFileHandler _fileHandler;
private readonly IGBaseEntryFactory _gBaseEntryFactory;
/// <summary> /// <summary>
/// A <see cref="IGBase"/> table /// A <see cref="IGBase"/> table
/// </summary> /// </summary>
public GBaseTable(IFileHandlerFactory fileHandlerFactory) public GBaseTable(IFileHandlerFactory fileHandlerFactory, IGBaseEntryFactory gBaseEntryFactory)
{ {
_fileHandler = fileHandlerFactory.Create(); _fileHandler = fileHandlerFactory.Create();
_gBaseEntryFactory = gBaseEntryFactory;
Entries = new List<IGBaseEntry>(); Entries = new List<IGBaseEntry>();
} }
@ -63,6 +68,15 @@ namespace GBase
await _fileHandler.Init(path, cancellationToken); await _fileHandler.Init(path, cancellationToken);
//TODO: Init Entries list depending on GBaseEntryAttributes set for this GBaseTable //TODO: Init Entries list depending on GBaseEntryAttributes set for this GBaseTable
foreach (var property in type.GetProperties())
{
GBaseEntryAttribute gBaseEntryAttribute = property.GetCustomAttribute<GBaseEntryAttribute>();
if (gBaseEntryAttribute == null)
continue;
IGBaseEntry gBaseEntry = _gBaseEntryFactory.Create();
AddEntry(gBaseEntry);
}
return true; return true;
} }

Loading…
Cancel
Save