0
devinedon created
Hi there,
What is the best approach to enable tracking on a dynamic properties itself? We are already using dynamic properties and finding it very effective however we would love some history changes along with who modified it (UserID).
2 Answer(s)
-
0
Hi devinedon, As far as I know, the relevant functions are not currently implemented. You can try to retrieve Entity History, or rewrite
IDynamicEntityPropertyValueManager
and add auditing when setting the value logic.public class CustomValueManager : DynamicEntityPropertyValueManager { public CustomValueManager(IDynamicPropertyPermissionChecker dynamicPropertyPermissionChecker, IDynamicPropertyManager dynamicPropertyManager, IDynamicEntityPropertyManager dynamicEntityPropertyManager) : base(dynamicPropertyPermissionChecker, dynamicPropertyManager, dynamicEntityPropertyManager) { } public override void Update(DynamicEntityPropertyValue dynamicEntityPropertyValue) { // Your audit code. base.Update(dynamicEntityPropertyValue); } }
Module Code:
public class YourAnyModule : AbpModule { public override void PreInitialize() { Configuration.ReplaceService<IDynamicEntityPropertyValueManager, CustomValueManager>(DependencyLifeStyle.Transient); } }
-
0
Great thanks! This makes sense. Will get going with this ASAP