protected void Execute(Action <MrcDataEntities> method)
 {
     try
     {
         using (var entities = new MrcDataEntities())
         {
             entities.Database.Log = this.DatabaseLog;
             method(entities);
         }
     }
     catch (Exception ex)
     {
         throw new Exception(this.SqlLog, ex);
     }
 }
 /// <summary>
 ///
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="method"></param>
 /// <returns></returns>
 /// <remarks>
 /// Usage:
 ///     return await this.ExecuteAsync(entities => entities.Database.ExecuteSqlCommandAsync("select * from Table where Id = @id", new SqlParameter { ParameterName = "@id", Value = 0 }));
 /// </remarks>
 protected async Task <T> ExecuteAsync <T>(Func <MrcDataEntities, Task <T> > method)
 {
     try
     {
         using (var entities = new MrcDataEntities())
         {
             entities.Database.Log = this.DatabaseLog;
             return(await method(entities).ConfigureAwait(false));
         }
     }
     catch (Exception ex)
     {
         throw new Exception(this.SqlLog, ex);
     }
 }
 protected T Execute <T>(Func <MrcDataEntities, T> method)
 {
     try
     {
         using (var entities = new MrcDataEntities())
         {
             entities.Database.Log = this.DatabaseLog;
             return(method(entities));
         }
     }
     catch (Exception ex)
     {
         throw new Exception(this.SqlLog, ex);
     }
 }