Added bulk attributes insert

This commit is contained in:
2026-01-25 16:32:37 +01:00
parent d7c248945d
commit 7d16f90c71
2 changed files with 19 additions and 2 deletions

View File

@@ -245,10 +245,16 @@ public class SearchdomainHelper(ILogger<SearchdomainHelper> logger, DatabaseHelp
else
{
int id_entity = DatabaseHelper.DatabaseInsertEntity(helper, jsonEntity.Name, jsonEntity.Probmethod, _databaseHelper.GetSearchdomainID(helper, jsonEntity.Searchdomain));
List<(string attribute, string value, int id_entity)> values = [];
foreach (KeyValuePair<string, string> attribute in jsonEntity.Attributes)
{
DatabaseHelper.DatabaseInsertAttribute(helper, attribute.Key, attribute.Value, id_entity); // TODO implement bulk insert to reduce number of queries
values.Add(new() {
attribute = attribute.Key,
value = attribute.Value,
id_entity = id_entity
});
}
DatabaseHelper.DatabaseInsertAttributes(helper, values);
List<Datapoint> datapoints = [];
foreach (JSONDatapoint jsonDatapoint in jsonEntity.Datapoints)