示例#1
0
 public DirectDocumentManipulator(IStorageMechanism s, DatabaseService _DatabaseService, IPecanLogger logger)
 {
     this.Logger          = logger;
     this.DatabaseService = _DatabaseService;
     this.sMech           = s ?? throw new ArgumentNullException(nameof(s));
 }
示例#2
0
        public static void LogDocument <TDocumentWithObject, TObjectOnly>(string documentId, TDocumentWithObject oldDoc, TDocumentWithObject newDoc, string operation, IStorageMechanism storageMechanism, string databaseName, DatabaseService DatabaseService)
            where TDocumentWithObject : IStandardDocument <TObjectOnly>
        {
            if (documentId == null)
            {
                throw new ArgumentNullException(nameof(documentId));
            }
            if (TypeOfWrapper.TypeOf(typeof(TDocumentWithObject)).Name != TypeOfWrapper.TypeOf(typeof(History <>)).Name)
            {
                HistoryService.UpdateDocumentHistory <TDocumentWithObject, TObjectOnly>(oldDoc, newDoc, storageMechanism, databaseName, DatabaseService);
            }

            if (TypeOfWrapper.TypeOf(typeof(TDocumentWithObject)).Name == TypeOfWrapper.TypeOf(typeof(SystemDb <>)).Name)
            {
                return;
            }
        }
示例#3
0
 public static DbStats GetSystemStatistics <TObjectOnly>(string documentName, DatabaseService DatabaseService)
 {
     return(GetSystemStatistics(DatabaseService, null, documentName));
 }
示例#4
0
        public StorageDatabase(IStorageMechanism storageMechanism, string documentName, DatabaseService dataBaseSettings, IPecanLogger logger)
        {
            this.Logger = logger;

            this.Logger?.Trace(this.GetType().Name, $"Initializing storage database ...");

            this.DataBaseSettings = dataBaseSettings;
            this.storageMechanism = storageMechanism;

            string dname = PecanDatabaseUtilityObj.DetermineDatabaseName <TDocumentWithObject, TObjectOnly>(documentName);

            this.DocumentName = dname;

            CurrentCount = this.storageMechanism.Count <TDocumentWithObject>(this.DocumentName, true);

            this.Logger?.Trace(this.GetType().Name, $"Initialized storage. Document Name {this.DocumentName} and current count {CurrentCount}");
        }