SqlExecute.cs 724 B

1234567891011121314151617181920212223242526
  1. using System.Linq;
  2. using System.Collections.Generic;
  3. using SQLite;
  4. namespace Vinno.vCloud.Disk.Database
  5. {
  6. public class SqlExecute
  7. {
  8. private static object locker = new object();
  9. private static SQLiteConnection _sQLiteConnection;
  10. public static SQLiteConnection DB {
  11. get
  12. {
  13. if (_sQLiteConnection == null || _sQLiteConnection.Handle.IsClosed)
  14. {
  15. lock (locker)
  16. {
  17. var helper = SqliteConnection.GetHelper();
  18. _sQLiteConnection = helper.DB;
  19. }
  20. }
  21. return _sQLiteConnection;
  22. }
  23. }
  24. }
  25. }