bilal-fazlani / tracker-enabled-dbcontext

Tracker-enabled DbContext offers you to implement full auditing in your database
https://tracker-enabled-dbcontext.bilal-fazlani.com/
Other
217 stars 110 forks source link

No tracking done #185

Closed Avdam closed 2 years ago

Avdam commented 2 years ago

I have a TrackerContext on which Set/Attach for a certain table is called:

    public static void AttachAllModifiedRecords<T>(
        this TrackerContext context,
        IEnumerable<T> records)
        where T : class
    {
        foreach (var record in records)
        {
            var set = context.Set<T>();
            set.Attach(record);
            DbEntityEntry entry = context.Entry(record);
            entry.State = EntityState.Modified;
        }
    }

Now, that table is not audit trailed. Is there a solution?

DoubleDot commented 2 years ago

It's in the documentation: https://tracker-enabled-dbcontext.bilal-fazlani.com/techniques/ " In this pattern, TEDB wont work by default. You will have to set GlobalTrackingConfig.DisconnectedContext = true; on application startup. "