Further developed collections

This commit is contained in:
schnulller
2022-06-27 02:16:20 +02:00
parent 0fa0ff6a88
commit abe473e9d5
12 changed files with 84 additions and 111 deletions

View File

@@ -19,6 +19,10 @@ public interface IXMLCollection {
abstract Func<XElement, IDictionary<string, string>?>? GenerateDataFields { get; }
abstract Func<IEnumerable<CollectedItem>, IDictionary<string, ILookup<string, CollectedItem>>?>? GroupingsGeneration { get; }
abstract Func<IEnumerable<CollectedItem>, IDictionary<string, IEnumerable<CollectedItem>>?>? SortingsGeneration { get; }
// TODO Not implemented yet
abstract IXMLCollection[]? SubCollections { get; }
abstract bool Searchable { get; }
// Override with false if collection should not be read in and available globally (useful for SubCollections)
bool IsGlobal() => true;
}

View File

@@ -32,7 +32,7 @@ public class XMLService : IXMLService {
collectiontypes.ForEach( x => {
if (this._Collections == null) this._Collections = new Dictionary<string, IXMLCollection>();
var instance = (IXMLCollection)Activator.CreateInstance(x)!;
if (instance != null) this._Collections.Add(instance.Key, instance);
if (instance != null && instance.IsGlobal()) this._Collections.Add(instance.Key, instance);
});
if (_Roots == null || !_Roots.Any())