C# Класс BlueCollar.SQLiteRepository

Наследование: IRepository
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
BeginTransaction ( ) : IDbTransaction

Begins a transaction.

BeginTransaction ( IsolationLevel level ) : IDbTransaction

Begins a transaction.

ClearWorkingSignalPair ( long workerId, long workingId, IDbTransaction transaction ) : void

Clears signals for the given worker and working job if applicable.

CreateQueuedAndHistoryForSchedule ( long scheduleId, System.DateTime scheduleDate, IEnumerable queued, IEnumerable history, IDbTransaction transaction ) : int

Creates the queue and history records for the given schedule.

DeleteAll ( string applicationName, IDbTransaction transaction ) : void

Deletes all data in the repository.

DeleteHistory ( string applicationName, System.DateTime olderThan, IDbTransaction transaction ) : void

Deletes history older than the given date.

DeleteQueued ( long id, IDbTransaction transaction ) : void

Deletes the queued record with the given ID.

DeleteSchedule ( long id, IDbTransaction transaction ) : void

Deletes the schedule record with the given ID.

DeleteScheduledJob ( long id, IDbTransaction transaction ) : void

Deletes the scheduled job record with the given ID.

DeleteWorker ( long id, IDbTransaction transaction ) : void

Deletes the worker record with the given ID.

DeleteWorking ( long id, IDbTransaction transaction ) : void

Deletes the working record with the given ID.

Dispose ( ) : void

Disposes of resources used by this instance.

GetCounts ( string applicationName, IDbTransaction transaction ) : CountsRecord

Gets a set of counts for the given application.

GetHistoryDetails ( long id, IDbTransaction transaction ) : HistoryDetailsRecord

Gets a history details record.

GetHistoryList ( string applicationName, string search, int limit, int offset, IDbTransaction transaction ) : RecordList

Gets a list of history records.

GetQueuedDetails ( long id, IDbTransaction transaction ) : QueueDetailsRecord

Gets a queued details record.

GetQueuedList ( string applicationName, string search, int limit, int offset, IDbTransaction transaction ) : RecordList

Gets a list of queue records.

GetSchedule ( long id, IDbTransaction transaction ) : ScheduleRecord

Gets the schedule with the given ID, NOT including its related scheduled jobs.

GetScheduleDateExistsForSchedule ( long scheduleId, System.DateTime scheduleDate, IDbTransaction transaction ) : bool

Gets a value indicating whether data exists for the given schedule ID and calculated schedule date. If it does, this indicates that jobs have already been enqueued for the schedule and should not be enqueued again until the next calculated schedule date.

GetScheduleEnqueueingLock ( long scheduleId, System.DateTime forceIfOlderThan, IDbTransaction transaction ) : bool

Attempts to obtain the enqueueing lock for the given schedule ID.

GetScheduleList ( string applicationName, string search, int limit, int offset, IDbTransaction transaction ) : RecordList

Gets a list of schedule records.

GetScheduledJobList ( string applicationName, long id, string search, int limit, int offset, IDbTransaction transaction ) : ScheduledJobRecordList

Gets a schedule and its related scheduled jobs, filtered by the given list parameters.

GetSchedules ( string applicationName, IDbTransaction transaction ) : IEnumerable

Gets a collection of schedules and their related scheduled jobs for the given application name.

GetStatistics ( string applicationName, System.DateTime recentBeginDate, System.DateTime distantBeginDate, System.DateTime endDate, IDbTransaction transaction ) : StatisticsRecord

Gets a set of system statistics for the given application name and date ranges.

GetWorker ( long id, IDbTransaction transaction ) : WorkerRecord

Gets the worker record with the given ID.

GetWorkerList ( string applicationName, string search, int limit, int offset, IDbTransaction transaction ) : RecordList

Gets a list of worker records.

GetWorkers ( string applicationName, string machineAddress, string machineName, IDbTransaction transaction ) : IEnumerable

Gets the worker collection for the given machine.

GetWorking ( long id, IDbTransaction transaction ) : WorkingRecord

Gets the working record with the given ID.

GetWorkingDetails ( long id, IDbTransaction transaction ) : WorkingDetailsRecord

Gets a working details record.

GetWorkingForWorker ( long workerId, long excludingId, IDbTransaction transaction ) : IEnumerable

Gets a collection of working records that belong to the given worker ID.

GetWorkingList ( string applicationName, string search, int limit, int offset, IDbTransaction transaction ) : RecordList

Gets a list of working records.

GetWorkingSignals ( long workerId, long workingId, IDbTransaction transaction ) : SignalsRecord

Gets the current signals set for a worker and a working job, if applicable.

ReleaseScheduleEnqueueingLock ( long scheduleId, IDbTransaction transaction ) : void

Releases the enqueueing lock for the schedule with the given ID.

SQLiteRepository ( string connectionString ) : System

Initializes a new instance of the SQLiteRepository class.

SignalWorkers ( string applicationName, WorkerSignal signal, IDbTransaction transaction ) : void

Signals all workers for the given application name.

UpdateSchedule ( ScheduleRecord record, IDbTransaction transaction ) : ScheduleRecord

Updates the given schedule.

UpdateScheduledJob ( ScheduledJobRecord record, IDbTransaction transaction ) : ScheduledJobRecord

Updates the given scheduled job.

UpdateScheduledJobOrder ( ScheduledJobOrderRecord record, IDbTransaction transaction ) : void

Updates the scheduled job's order number.

UpdateWorker ( WorkerRecord record, IDbTransaction transaction ) : WorkerRecord

Updates the given worker.

UpdateWorkerStatus ( long id, WorkerStatus status, IDbTransaction transaction ) : void

Updates the status of the worker with the given ID.

UpdateWorking ( WorkingRecord record, IDbTransaction transaction ) : WorkingRecord

Updates the given working record.

Защищенные методы

Метод Описание
Dispose ( bool disposing ) : void

Disposes of resources used by this instance.

EnsureDatabase ( string path ) : void

Ensures that the SQLite database at the given path exists, creating it if it doesn't.

Приватные методы

Метод Описание
CreateCounts ( Dapper.SqlMapper multi ) : CountsRecord

Creates a new CountsRecord by reading from the given multi-mapped reader.

CreateHistory ( HistoryRecord record, IDbTransaction transaction ) : HistoryRecord
CreateHistoryStatusCounts ( Dapper.SqlMapper multi ) : HistoryStatusCountsRecord

Creates a new HistoryStatusCountsRecord by reading from the given multi-mapped reader.

CreateQueued ( QueueRecord record, IDbTransaction transaction ) : QueueRecord
CreateSchedule ( ScheduleRecord record, IDbTransaction transaction ) : ScheduleRecord
CreateScheduledJob ( ScheduledJobRecord record, IDbTransaction transaction ) : ScheduledJobRecord
CreateWorker ( WorkerRecord record, IDbTransaction transaction ) : WorkerRecord
CreateWorking ( WorkingRecord record, IDbTransaction transaction ) : WorkingRecord
GetQueued ( string applicationName, QueueNameFilters queueFilters, System.DateTime queuedBefore, IDbTransaction transaction ) : QueueRecord

Описание методов

BeginTransaction() публичный Метод

Begins a transaction.
public BeginTransaction ( ) : IDbTransaction
Результат IDbTransaction

BeginTransaction() публичный Метод

Begins a transaction.
public BeginTransaction ( IsolationLevel level ) : IDbTransaction
level IsolationLevel The isolation level to use for the transaction.
Результат IDbTransaction

ClearWorkingSignalPair() публичный Метод

Clears signals for the given worker and working job if applicable.
public ClearWorkingSignalPair ( long workerId, long workingId, IDbTransaction transaction ) : void
workerId long The ID of the worker to clear the signal of.
workingId long The ID of the working job to clear the signal of, if applicable.
transaction IDbTransaction The transaction to use, if applicable.
Результат void

CreateQueuedAndHistoryForSchedule() публичный Метод

Creates the queue and history records for the given schedule.
public CreateQueuedAndHistoryForSchedule ( long scheduleId, System.DateTime scheduleDate, IEnumerable queued, IEnumerable history, IDbTransaction transaction ) : int
scheduleId long The ID of the schedule records are being created for.
scheduleDate System.DateTime The schedule date records are being created for.
queued IEnumerable The queued records to create.
history IEnumerable The history records to create.
transaction IDbTransaction The transaction to use, if applicable.
Результат int

DeleteAll() публичный Метод

Deletes all data in the repository.
public DeleteAll ( string applicationName, IDbTransaction transaction ) : void
applicationName string The name of the application to delete data for.
transaction IDbTransaction The transaction to use, if applicable.
Результат void

DeleteHistory() публичный Метод

Deletes history older than the given date.
public DeleteHistory ( string applicationName, System.DateTime olderThan, IDbTransaction transaction ) : void
applicationName string The name of the application to delete data for.
olderThan System.DateTime The date to delete history older than.
transaction IDbTransaction The transaction to use, if applicable.
Результат void

DeleteQueued() публичный Метод

Deletes the queued record with the given ID.
public DeleteQueued ( long id, IDbTransaction transaction ) : void
id long The ID of the queued record to delete.
transaction IDbTransaction The transaction to use, if applicable.
Результат void

DeleteSchedule() публичный Метод

Deletes the schedule record with the given ID.
public DeleteSchedule ( long id, IDbTransaction transaction ) : void
id long The ID of the schedule to delete.
transaction IDbTransaction The transaction to use, if applicable.
Результат void

DeleteScheduledJob() публичный Метод

Deletes the scheduled job record with the given ID.
public DeleteScheduledJob ( long id, IDbTransaction transaction ) : void
id long The ID of the scheduled job to delete.
transaction IDbTransaction The transaction to use, if applicable.
Результат void

DeleteWorker() публичный Метод

Deletes the worker record with the given ID.
public DeleteWorker ( long id, IDbTransaction transaction ) : void
id long The ID of the worker to delete.
transaction IDbTransaction The transaction to use, if applicable.
Результат void

DeleteWorking() публичный Метод

Deletes the working record with the given ID.
public DeleteWorking ( long id, IDbTransaction transaction ) : void
id long The ID of the working record to delete.
transaction IDbTransaction The transaction to use, if applicable.
Результат void

Dispose() публичный Метод

Disposes of resources used by this instance.
public Dispose ( ) : void
Результат void

Dispose() защищенный Метод

Disposes of resources used by this instance.
protected Dispose ( bool disposing ) : void
disposing bool A value indicating whether to dispose of managed resources.
Результат void

EnsureDatabase() защищенный статический Метод

Ensures that the SQLite database at the given path exists, creating it if it doesn't.
protected static EnsureDatabase ( string path ) : void
path string The path of the SQLite database to ensure.
Результат void

GetCounts() публичный Метод

Gets a set of counts for the given application.
public GetCounts ( string applicationName, IDbTransaction transaction ) : CountsRecord
applicationName string The name of the application to get counts for.
transaction IDbTransaction The transaction to use, if applicable.
Результат CountsRecord

GetHistoryDetails() публичный Метод

Gets a history details record.
public GetHistoryDetails ( long id, IDbTransaction transaction ) : HistoryDetailsRecord
id long The ID of the record to get.
transaction IDbTransaction The transaction to use, if applicable.
Результат HistoryDetailsRecord

GetHistoryList() публичный Метод

Gets a list of history records.
public GetHistoryList ( string applicationName, string search, int limit, int offset, IDbTransaction transaction ) : RecordList
applicationName string The name of the application to get the history list for.
search string The search query to filter the collection with.
limit int The paging limit to use.
offset int The paging offset to use.
transaction IDbTransaction The transaction to use, if applicable.
Результат RecordList

GetQueuedDetails() публичный Метод

Gets a queued details record.
public GetQueuedDetails ( long id, IDbTransaction transaction ) : QueueDetailsRecord
id long The ID of the record to get.
transaction IDbTransaction The transaction to use, if applicable.
Результат QueueDetailsRecord

GetQueuedList() публичный Метод

Gets a list of queue records.
public GetQueuedList ( string applicationName, string search, int limit, int offset, IDbTransaction transaction ) : RecordList
applicationName string The name of the application to get the queue list for.
search string The search query to filter the collection with.
limit int The paging limit to use.
offset int The paging offset to use.
transaction IDbTransaction The transaction to use, if applicable.
Результат RecordList

GetSchedule() публичный Метод

Gets the schedule with the given ID, NOT including its related scheduled jobs.
public GetSchedule ( long id, IDbTransaction transaction ) : ScheduleRecord
id long The ID of the schedule to get.
transaction IDbTransaction The transaction to use, if applicable.
Результат ScheduleRecord

GetScheduleDateExistsForSchedule() публичный Метод

Gets a value indicating whether data exists for the given schedule ID and calculated schedule date. If it does, this indicates that jobs have already been enqueued for the schedule and should not be enqueued again until the next calculated schedule date.
public GetScheduleDateExistsForSchedule ( long scheduleId, System.DateTime scheduleDate, IDbTransaction transaction ) : bool
scheduleId long The ID of the schedule to check data for.
scheduleDate System.DateTime The calculated schedule date to check data for.
transaction IDbTransaction The transaction to use, if applicable.
Результат bool

GetScheduleEnqueueingLock() публичный Метод

Attempts to obtain the enqueueing lock for the given schedule ID.
public GetScheduleEnqueueingLock ( long scheduleId, System.DateTime forceIfOlderThan, IDbTransaction transaction ) : bool
scheduleId long The ID of the schedule to obtain the schedule enqueueing lock for.
forceIfOlderThan System.DateTime A date to compare the enqueue lock's last updated date with. If /// the lock is older than the given date, then it will be forced and acquired by the caller.
transaction IDbTransaction The transaction to use, if applicable.
Результат bool

GetScheduleList() публичный Метод

Gets a list of schedule records.
public GetScheduleList ( string applicationName, string search, int limit, int offset, IDbTransaction transaction ) : RecordList
applicationName string The name of the application to get the schedule list for.
search string The search query to filter the collection with.
limit int The paging limit to use.
offset int The paging offset to use.
transaction IDbTransaction The transaction to use, if applicable.
Результат RecordList

GetScheduledJobList() публичный Метод

Gets a schedule and its related scheduled jobs, filtered by the given list parameters.
public GetScheduledJobList ( string applicationName, long id, string search, int limit, int offset, IDbTransaction transaction ) : ScheduledJobRecordList
applicationName string The name of the application to get the scheduled job list for.
id long The ID of the schedule to get.
search string The search query to filter the related job collection with.
limit int The paging limit to use.
offset int The paging offset to use.
transaction IDbTransaction The transaction to use, if applicable.
Результат ScheduledJobRecordList

GetSchedules() публичный Метод

Gets a collection of schedules and their related scheduled jobs for the given application name.
public GetSchedules ( string applicationName, IDbTransaction transaction ) : IEnumerable
applicationName string The name of the application to get schedules for.
transaction IDbTransaction The transaction to use, if applicable.
Результат IEnumerable

GetStatistics() публичный Метод

Gets a set of system statistics for the given application name and date ranges.
public GetStatistics ( string applicationName, System.DateTime recentBeginDate, System.DateTime distantBeginDate, System.DateTime endDate, IDbTransaction transaction ) : StatisticsRecord
applicationName string The name of the application to get system statistics for.
recentBeginDate System.DateTime The begin date of the recent period to get statistics for.
distantBeginDate System.DateTime The begin date of the distant period to get statistics for.
endDate System.DateTime The end date of the distant period to get statistics for.
transaction IDbTransaction The transaction to use, if applicable.
Результат StatisticsRecord

GetWorker() публичный Метод

Gets the worker record with the given ID.
public GetWorker ( long id, IDbTransaction transaction ) : WorkerRecord
id long The ID of the worker record to get.
transaction IDbTransaction The transaction to use.
Результат WorkerRecord

GetWorkerList() публичный Метод

Gets a list of worker records.
public GetWorkerList ( string applicationName, string search, int limit, int offset, IDbTransaction transaction ) : RecordList
applicationName string The application name to get records for.
search string The search query to filter the collection with.
limit int The paging limit to use.
offset int The paging offset to use.
transaction IDbTransaction The transaction to use, if applicable.
Результат RecordList

GetWorkers() публичный Метод

Gets the worker collection for the given machine.
public GetWorkers ( string applicationName, string machineAddress, string machineName, IDbTransaction transaction ) : IEnumerable
applicationName string The application name to get workers for.
machineAddress string The address of the machine to get workers for.
machineName string The name of the machine to get workers for.
transaction IDbTransaction The transaction to use, if applicable.
Результат IEnumerable

GetWorking() публичный Метод

Gets the working record with the given ID.
public GetWorking ( long id, IDbTransaction transaction ) : WorkingRecord
id long The ID of the record to get.
transaction IDbTransaction The transaction to use, if applicable.
Результат WorkingRecord

GetWorkingDetails() публичный Метод

Gets a working details record.
public GetWorkingDetails ( long id, IDbTransaction transaction ) : WorkingDetailsRecord
id long The ID of the record to get.
transaction IDbTransaction The transaction to use, if applicable.
Результат WorkingDetailsRecord

GetWorkingForWorker() публичный Метод

Gets a collection of working records that belong to the given worker ID.
public GetWorkingForWorker ( long workerId, long excludingId, IDbTransaction transaction ) : IEnumerable
workerId long The ID of the worker to get working records for.
excludingId long The ID of the working record to exclude, if applicable.
transaction IDbTransaction The transaction to use, if applicable.
Результат IEnumerable

GetWorkingList() публичный Метод

Gets a list of working records.
public GetWorkingList ( string applicationName, string search, int limit, int offset, IDbTransaction transaction ) : RecordList
applicationName string The application name to get records for.
search string The search query to filter the collection with.
limit int The paging limit to use.
offset int The paging offset to use.
transaction IDbTransaction The transaction to use, if applicable.
Результат RecordList

GetWorkingSignals() публичный Метод

Gets the current signals set for a worker and a working job, if applicable.
public GetWorkingSignals ( long workerId, long workingId, IDbTransaction transaction ) : SignalsRecord
workerId long The ID of the worker to get a signal for.
workingId long The ID of the working job to get a signal for, if applicable.
transaction IDbTransaction The transaction to use, if applicable.
Результат SignalsRecord

ReleaseScheduleEnqueueingLock() публичный Метод

Releases the enqueueing lock for the schedule with the given ID.
public ReleaseScheduleEnqueueingLock ( long scheduleId, IDbTransaction transaction ) : void
scheduleId long The ID of the schedule to release the enqueueing lock for.
transaction IDbTransaction The transaction to use, if applicable.
Результат void

SQLiteRepository() публичный Метод

Initializes a new instance of the SQLiteRepository class.
public SQLiteRepository ( string connectionString ) : System
connectionString string The connection string to use when connecting to the database.
Результат System

SignalWorkers() публичный Метод

Signals all workers for the given application name.
public SignalWorkers ( string applicationName, WorkerSignal signal, IDbTransaction transaction ) : void
applicationName string The application name to signal workers for.
signal WorkerSignal The signal to set.
transaction IDbTransaction The transaction to use, if applicable.
Результат void

UpdateSchedule() публичный Метод

Updates the given schedule.
public UpdateSchedule ( ScheduleRecord record, IDbTransaction transaction ) : ScheduleRecord
record ScheduleRecord The schedule record to update.
transaction IDbTransaction The transaction to use, if applicable.
Результат ScheduleRecord

UpdateScheduledJob() публичный Метод

Updates the given scheduled job.
public UpdateScheduledJob ( ScheduledJobRecord record, IDbTransaction transaction ) : ScheduledJobRecord
record ScheduledJobRecord The scheduled job record to update.
transaction IDbTransaction The transaction to use, if applicable.
Результат ScheduledJobRecord

UpdateScheduledJobOrder() публичный Метод

Updates the scheduled job's order number.
public UpdateScheduledJobOrder ( ScheduledJobOrderRecord record, IDbTransaction transaction ) : void
record ScheduledJobOrderRecord The scheduled job order record identifying the scheduled job to update.
transaction IDbTransaction The transaction to use, if applicable.
Результат void

UpdateWorker() публичный Метод

Updates the given worker.
public UpdateWorker ( WorkerRecord record, IDbTransaction transaction ) : WorkerRecord
record WorkerRecord The worker record to update.
transaction IDbTransaction The transaction to use, if applicable.
Результат WorkerRecord

UpdateWorkerStatus() публичный Метод

Updates the status of the worker with the given ID.
public UpdateWorkerStatus ( long id, WorkerStatus status, IDbTransaction transaction ) : void
id long The ID of the worker to update status for.
status WorkerStatus The status to update.
transaction IDbTransaction The transaction to use, if applicable.
Результат void

UpdateWorking() публичный Метод

Updates the given working record.
public UpdateWorking ( WorkingRecord record, IDbTransaction transaction ) : WorkingRecord
record WorkingRecord The working record to update.
transaction IDbTransaction The transaction to use, if applicable.
Результат WorkingRecord