I m using tracker-enabled-dbcontext and using documentation to capture DB audit logs, configure tracking we need to be used
EntityTracker
.TrackAllProperties<NormalModel>()
.Except(x => x.Description)
.And(x => x.Id);
I have multiple Model classes so I decide to control the configuration dynamically. so I need to retrieve the Model class using namespace and pass it to the TrackAllProperties method.
I tried to like this,
Type test = Type.GetType("Mark.Domain.assets.AssetsSettings");
TrackerEnabledDbContext.Common.Configuration.EntityTracker.TrackAllProperties<test>();
but it does not accept "test" Type
This is the TrackAllProperties method. I'm not allowed to modify the following method
public static TrackAllResponse<T> TrackAllProperties<T>()
{
OverrideTracking<T>().Enable();
var allPublicInstanceProperties = typeof (T).GetProperties(BindingFlags.Public | BindingFlags.Instance);
//add high priority tracking to all properties
foreach (var property in allPublicInstanceProperties)
{
Func<PropertyConfiguerationKey, TrackingConfigurationValue, TrackingConfigurationValue> factory =
(key,value) => new TrackingConfigurationValue(true, TrackingConfigurationPriority.High);
TrackingDataStore.PropertyConfigStore.AddOrUpdate(
new PropertyConfiguerationKey(property.Name, typeof (T).FullName),
new TrackingConfigurationValue(true, TrackingConfigurationPriority.High),
factory
);
}
return new TrackAllResponse<T>();
}
How I can achieve this task