|
@@ -1,5 +1,6 @@
|
|
|
using Comal.Classes;
|
|
|
using InABox.Core;
|
|
|
+using InABox.Database;
|
|
|
using InABox.Scripting;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
@@ -62,7 +63,7 @@ public class SaveEventDataModelDefinition<T>(SaveEvent<T> ev) : IEventDataModelD
|
|
|
{
|
|
|
if(variables is null)
|
|
|
{
|
|
|
- var prefix = $"{typeof(T)}.";
|
|
|
+ var prefix = $"{typeof(T).Name}.";
|
|
|
if (name.StartsWith(prefix))
|
|
|
{
|
|
|
name = name[prefix.Length..];
|
|
@@ -97,17 +98,19 @@ public class SaveEventDataModel<T>(T entity) : IEventDataModel, ITypedEventDataM
|
|
|
|
|
|
public bool TryGetVariable(string name, out object? value)
|
|
|
{
|
|
|
- var prop = DatabaseSchema.Property(typeof(T), name);
|
|
|
- if(prop != null)
|
|
|
+ var prefix = $"{typeof(T).Name}.";
|
|
|
+ if (name.StartsWith(prefix))
|
|
|
{
|
|
|
- value = prop.Getter()(Entity);
|
|
|
- return true;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- value = null;
|
|
|
- return false;
|
|
|
+ name = name[prefix.Length..];
|
|
|
+ var prop = DatabaseSchema.Property(typeof(T), name);
|
|
|
+ if(prop != null)
|
|
|
+ {
|
|
|
+ value = prop.Getter()(Entity);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
}
|
|
|
+ value = null;
|
|
|
+ return false;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -361,6 +364,7 @@ public class CreateEntitySaveEventAction<T> : IEventAction<SaveEvent<T>>
|
|
|
{
|
|
|
initializer.Execute(entity, dataModel);
|
|
|
}
|
|
|
+ DbFactory.FindStore(EntityType, Guid.Empty, "", default, "", Logger.Main).Save(entity, "");
|
|
|
return entity;
|
|
|
}
|
|
|
|