Skip to content

Commit

Permalink
Dynamic configuration options.
Browse files Browse the repository at this point in the history
  • Loading branch information
NTDLS committed Oct 9, 2024
1 parent e8799bb commit 1c27a46
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 23 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using ICSharpCode.AvalonEdit.Document;
using NTDLS.Helpers;
using NTDLS.Katzebase.Management.Classes.Editor.FoldingStrategy;
using NTDLS.Katzebase.Management.Classes.Editor;
using NTDLS.Katzebase.Parsers.Query.SupportingTypes;
using System.Windows.Media;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using NTDLS.Katzebase.Parsers.Query.Specific.WithOptions;
using NTDLS.Katzebase.Parsers.Query.SupportingTypes;
using NTDLS.Katzebase.Parsers.Tokens;
using NTDLS.Katzebase.Shared;
using System.Reflection;
using static NTDLS.Katzebase.Parsers.Constants;

namespace NTDLS.Katzebase.Parsers.Query.Specific
Expand All @@ -16,29 +18,14 @@ internal static PreparedQuery Parse(QueryBatch queryBatch, Tokenizer tokenizer)

tokenizer.EatIfNext("with");

var options = new ExpectedWithOptions
var options = new ExpectedWithOptions();

var properties = typeof(KatzebaseSettings).GetProperties(BindingFlags.Public | BindingFlags.Instance);

foreach (var property in properties)
{
{ "BaseAddress", typeof(string) },
{ "DataRootPath", typeof(string) },
{ "TransactionDataPath", typeof(string) },
{ "LogDirectory", typeof(string) },
{ "FlushLog", typeof(bool) },
{ "DefaultDocumentPageSize", typeof(int) },
{ "UseCompression", typeof(bool) },
{ "HealthMonitoringEnabled", typeof(bool) },
{ "HealthMonitoringCheckpointSeconds", typeof(int) },
{ "HealthMonitoringInstanceLevelEnabled", typeof(bool) },
{ "HealthMonitoringInstanceLevelTimeToLiveSeconds", typeof(int) },
{ "MaxIdleConnectionSeconds", typeof(int) },
{ "DefaultIndexPartitions", typeof(int) },
{ "DeferredIOEnabled", typeof(bool) },
{ "WriteTraceData", typeof(bool) },
{ "CacheEnabled", typeof(bool) },
{ "CacheMaxMemory", typeof(int) },
{ "CacheScavengeInterval", typeof(int) },
{ "CachePartitions", typeof(int) },
{ "CacheSeconds", typeof(int) }
};
options.Add(property.Name, property.PropertyType);
}

query.AddAttributes(StaticParserWithOptions.Parse(tokenizer, options));

Expand Down

0 comments on commit 1c27a46

Please sign in to comment.