Пример #1
0
        public override DataChangesResult MakeDataChanges()
        {
            //System.Diagnostics.Debugger.Launch();

            try
            {
                if (_adapterState != AdapterState.Stopped)
                {
                    return(DataChangesResult.NoChangesPending);
                }

                if (IsWarehouseHostCancelled || IsWarehouseSchemaLockRequested)
                {
                    return(ChangeAdapterState(DataChangesResult.DataChangesPending));
                }

                using (var dac = WarehouseContext.CreateWarehouseDataAccessComponent())
                {
                    if (_warehouseVersion.NeedSchemaChanges(dac))
                    {
                        return(ChangeAdapterState(DataChangesResult.SchemaChangesPending));
                    }

                    TFSUsersLogUpdater.UpdateTFSUsersLog(TFSUtils.ReturnDataFromWarehousePropertyBag <DateTime>(dac, dateOfLastCommandSavedProperty), _tpcDatabase.ConnectionString, _tfsLogUsageConnString);
                }

                return(ChangeAdapterState(DataChangesResult.NoChangesPending));
            }
            catch (Exception err)
            {
                Utils.Log.LogEvent(RequestContext, err.Message, Utils.Log.LogEventInformationLevel.Error);
                throw;
            }
        }
Пример #2
0
        public override void MakeSchemaChanges()
        {
            try
            {
                var updater = new DatabaseUpdater <TFSUsersContext>(_tfsLogUsageConnString);

                updater.CreateDatabaseIfNotExists();

                using (var dac = WarehouseContext.CreateWarehouseDataAccessComponent())
                {
                    _warehouseVersion.SetWarehouseVersion(dac);
                }
            }
            catch (Exception err)
            {
                Utils.Log.LogEvent(RequestContext, err.Message, Utils.Log.LogEventInformationLevel.Error);
                throw;
            }
        }