Quantcast
Channel: ADO.NET, Entity Framework, LINQ to SQL, NHibernate
Viewing all articles
Browse latest Browse all 1698

Audit Trail in Entity Framework 6.1.3?

$
0
0

Hi 

I am using generic repository pattern for CRUD operations. I want to audit trail when User modify record. I want to log modified property name, current value and new value. How to log this using EF 6.1.3?

  public class DataRepository<TEntity> : IRepository<TEntity> where TEntity : class
    {
    public bool Update(TEntity entity)
        {
            try
            {
                using (rateEntities entities = new rateEntities())
                {
                    entities.Entry(entity).State = System.Data.Entity.EntityState.Modified;
                    entities.SaveChanges();
                    return true;
                }
            }
            catch (Exception exception)
            {
                throw exception;
            }
        }
}

Thanks


Viewing all articles
Browse latest Browse all 1698

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>