/// <summary>
 /// Dispose the connection
 /// </summary>
 public virtual void Dispose()
 {
     OpenedDataReaders.Clear();
     _attachedObjects.Clear();
     Trans?.Dispose();
     SqlConnection?.Dispose();
     Trans         = null;
     SqlConnection = null;
 }
 public static void CleanCachedItems()
 {
     CachedFields.Clear();
     CachedTypes.Clear();
     CachedConstructor.Clear();
     CachedPropertyInfo.Clear();
     CachedDynamicMethod.Clear();
     DefaultConstructor.Clear();
 }
 /// <summary>
 /// commit the transaction
 /// </summary>
 public void SaveChanges()
 {
     try
     {
         Trans?.Commit();
     }
     catch
     {
         Rollback();
         throw;
     }
     finally
     {
         OpenedDataReaders.Clear();
         Trans?.Dispose();
         SqlConnection?.Dispose();
         Trans         = null;
         SqlConnection = null;
     }
 }
 /// <summary>
 /// commit the transaction
 /// </summary>
 public void SaveChanges()
 {
     try
     {
         Trans?.Commit();
     }
     catch (Exception ex)
     {
         Rollback();
         throw new EntityException(ex.Message);
     }
     finally
     {
         OpenedDataReaders.Clear();
         Trans?.Dispose();
         SqlConnection?.Dispose();
         Trans         = null;
         SqlConnection = null;
     }
 }