diff --git a/GBase/GBase.xml b/GBase/GBase.xml index a31bd2b..61527f0 100644 --- a/GBase/GBase.xml +++ b/GBase/GBase.xml @@ -500,7 +500,7 @@ A table - + A table diff --git a/GBase/GBaseTable.cs b/GBase/GBaseTable.cs index dcca848..571fd3d 100644 --- a/GBase/GBaseTable.cs +++ b/GBase/GBaseTable.cs @@ -5,8 +5,11 @@ using System; using System.Collections.Generic; using System.IO; +using System.Reflection; using System.Threading; using System.Threading.Tasks; +using GBase.Attributes; +using GBase.Factories; using GBase.FileHandling.Factories; using GBase.Interfaces; using GBase.Interfaces.FileHandling; @@ -19,13 +22,15 @@ namespace GBase public class GBaseTable : IGBaseTable { private readonly IFileHandler _fileHandler; + private readonly IGBaseEntryFactory _gBaseEntryFactory; /// /// A table /// - public GBaseTable(IFileHandlerFactory fileHandlerFactory) + public GBaseTable(IFileHandlerFactory fileHandlerFactory, IGBaseEntryFactory gBaseEntryFactory) { _fileHandler = fileHandlerFactory.Create(); + _gBaseEntryFactory = gBaseEntryFactory; Entries = new List(); } @@ -63,6 +68,15 @@ namespace GBase await _fileHandler.Init(path, cancellationToken); //TODO: Init Entries list depending on GBaseEntryAttributes set for this GBaseTable + foreach (var property in type.GetProperties()) + { + GBaseEntryAttribute gBaseEntryAttribute = property.GetCustomAttribute(); + if (gBaseEntryAttribute == null) + continue; + + IGBaseEntry gBaseEntry = _gBaseEntryFactory.Create(); + AddEntry(gBaseEntry); + } return true; }