public SqlServerCache(IOptions<SqlServerCacheOptions> options) { var cacheOptions = options.Value; if (string.IsNullOrEmpty(cacheOptions.ConnectionString)) { throw new ArgumentException( $"{nameof(SqlServerCacheOptions.ConnectionString)} cannot be empty or null."); } if (string.IsNullOrEmpty(cacheOptions.SchemaName)) { throw new ArgumentException( $"{nameof(SqlServerCacheOptions.SchemaName)} cannot be empty or null."); } if (string.IsNullOrEmpty(cacheOptions.TableName)) { throw new ArgumentException( $"{nameof(SqlServerCacheOptions.TableName)} cannot be empty or null."); } if (cacheOptions.ExpiredItemsDeletionInterval.HasValue && cacheOptions.ExpiredItemsDeletionInterval.Value < MinimumExpiredItemsDeletionInterval) { throw new ArgumentException( $"{nameof(SqlServerCacheOptions.ExpiredItemsDeletionInterval)} cannot be less the minimum " + $"value of {MinimumExpiredItemsDeletionInterval.TotalMinutes} minutes."); } _systemClock = cacheOptions.SystemClock ?? new SystemClock(); _expiredItemsDeletionInterval = cacheOptions.ExpiredItemsDeletionInterval ?? DefaultExpiredItemsDeletionInterval; _deleteExpiredCachedItemsDelegate = DeleteExpiredCacheItems; // SqlClient library on Mono doesn't have support for DateTimeOffset and also // it doesn't have support for apis like GetFieldValue, GetFieldValueAsync etc. // So we detect the platform to perform things differently for Mono vs. non-Mono platforms. if (PlatformHelper.IsMono) { _dbOperations = new MonoDatabaseOperations( cacheOptions.ConnectionString, cacheOptions.SchemaName, cacheOptions.TableName, _systemClock); } else { _dbOperations = new DatabaseOperations( cacheOptions.ConnectionString, cacheOptions.SchemaName, cacheOptions.TableName, _systemClock); } }
/// <summary> /// Retrieves metric definitions for the given database. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='resourceGroupName'> /// The name of the resource group. The name is case insensitive. /// </param> /// <param name='accountName'> /// Cosmos DB database account name. /// </param> /// <param name='databaseRid'> /// Cosmos DB database rid. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <IEnumerable <MetricDefinition> > ListMetricDefinitionsAsync(this IDatabaseOperations operations, string resourceGroupName, string accountName, string databaseRid, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListMetricDefinitionsWithHttpMessagesAsync(resourceGroupName, accountName, databaseRid, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Retrieves the usages (most recent data) for the given database. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='resourceGroupName'> /// The name of the resource group. The name is case insensitive. /// </param> /// <param name='accountName'> /// Cosmos DB database account name. /// </param> /// <param name='databaseRid'> /// Cosmos DB database rid. /// </param> /// <param name='filter'> /// An OData filter expression that describes a subset of usages to return. The /// supported parameter is name.value (name of the metric, can have an or of /// multiple names). /// </param> public static IEnumerable <Usage> ListUsages(this IDatabaseOperations operations, string resourceGroupName, string accountName, string databaseRid, string filter = default(string)) { return(operations.ListUsagesAsync(resourceGroupName, accountName, databaseRid, filter).GetAwaiter().GetResult()); }
/// <summary> /// Returns the list SQL Server databases. /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.WindowsAzure.Management.Sql.IDatabaseOperations. /// </param> /// <param name='serverName'> /// Required. The name of the database server to be queried. /// </param> /// <returns> /// Response containing the list of databases for a given server. /// </returns> public static Task <DatabaseListResponse> ListAsync(this IDatabaseOperations operations, string serverName) { return(operations.ListAsync(serverName, CancellationToken.None)); }
/// <summary> /// Drops a SQL Database server from a subscription. (see /// http://msdn.microsoft.com/en-us/library/windowsazure/gg715285.aspx /// for more information) /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.WindowsAzure.Management.Sql.IDatabaseOperations. /// </param> /// <param name='serverName'> /// Required. The name of the server on which the database is found. /// </param> /// <param name='databaseName'> /// Required. The name of the database to be deleted. /// </param> /// <returns> /// A standard service response including an HTTP status code and /// request ID. /// </returns> public static Task <OperationResponse> DeleteAsync(this IDatabaseOperations operations, string serverName, string databaseName) { return(operations.DeleteAsync(serverName, databaseName, CancellationToken.None)); }
/// <summary> /// Returns information about Azure SQL Database usages. /// </summary> /// <param name='operations'> /// Reference to the Microsoft.Azure.Management.Sql.IDatabaseOperations. /// </param> /// <param name='resourceGroupName'> /// Required. The name of the Resource Group to which the server /// belongs. /// </param> /// <param name='serverName'> /// Required. The name of the Azure SQL Database Server in which the /// Azure SQL Databases are hosted. /// </param> /// <param name='databaseName'> /// Required. The name of the Azure SQL Database. /// </param> /// <returns> /// Represents the response to a List Azure Sql Database metrics /// request. /// </returns> public static Task <DatabaseMetricListResponse> ListUsagesAsync(this IDatabaseOperations operations, string resourceGroupName, string serverName, string databaseName) { return(operations.ListUsagesAsync(resourceGroupName, serverName, databaseName, CancellationToken.None)); }
/// <summary> /// Returns information about an Azure SQL Database. /// </summary> /// <param name='operations'> /// Reference to the Microsoft.Azure.Management.Sql.IDatabaseOperations. /// </param> /// <param name='resourceGroupName'> /// Required. The name of the Resource Group to which the server /// belongs. /// </param> /// <param name='serverName'> /// Required. The name of the Azure SQL Database Server on which the /// database is hosted. /// </param> /// <param name='databaseId'> /// Required. The Id of the Azure SQL Database to be retrieved. /// </param> /// <returns> /// Represents the response to a List Azure Sql Database request. /// </returns> public static Task <DatabaseListResponse> GetByIdAsync(this IDatabaseOperations operations, string resourceGroupName, string serverName, string databaseId) { return(operations.GetByIdAsync(resourceGroupName, serverName, databaseId, CancellationToken.None)); }
internal static IDistributedCache CreateMySqlServerCache(ISystemClock clock = null, IDatabaseOperations databaseOperations = null) { if (clock != null) { var options = TestConfiguration.MySqlServerCacheOptions.Clone(); options.SystemClock = clock; options.DatabaseOperations = databaseOperations; return(new MySqlServerCache(options)); } return(new MySqlServerCache(TestConfiguration.MySqlServerCacheOptions)); }
public StockPriceHistoryInsertion(IBaseData baseData, IDatabaseOperations database) { _baseData = baseData; _database = database; }
/// <summary> /// Gets a list of operations performed on the database. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='resourceGroupName'> /// The name of the resource group that contains the resource. You can obtain /// this value from the Azure Resource Manager API or the portal. /// </param> /// <param name='serverName'> /// The name of the server. /// </param> /// <param name='databaseName'> /// The name of the database. /// </param> public static IPage <DatabaseOperation> ListByDatabase(this IDatabaseOperations operations, string resourceGroupName, string serverName, string databaseName) { return(operations.ListByDatabaseAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult()); }
/// <summary> /// Cancels the asynchronous operation on the database. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='resourceGroupName'> /// The name of the resource group that contains the resource. You can obtain /// this value from the Azure Resource Manager API or the portal. /// </param> /// <param name='serverName'> /// The name of the server. /// </param> /// <param name='databaseName'> /// The name of the database. /// </param> /// <param name='operationId'> /// The operation identifier. /// </param> public static void Cancel(this IDatabaseOperations operations, string resourceGroupName, string serverName, string databaseName, System.Guid operationId) { operations.CancelAsync(resourceGroupName, serverName, databaseName, operationId).GetAwaiter().GetResult(); }
/// <summary> /// Gets a list of operations performed on the database. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='nextPageLink'> /// The NextLink from the previous successful call to List operation. /// </param> public static IPage <DatabaseOperation> ListByDatabaseNext(this IDatabaseOperations operations, string nextPageLink) { return(operations.ListByDatabaseNextAsync(nextPageLink).GetAwaiter().GetResult()); }
public GetLastMatchCheckTimeFromDatabase(ILogger logger, IDatabaseOperations database) { _logger = logger; _database = database; }
public BranchesController() { _context = new MongoOperations(); }
/// <summary> /// Gets a list of operations performed on the database. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='nextPageLink'> /// The NextLink from the previous successful call to List operation. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <IPage <DatabaseOperationInner> > ListByDatabaseNextAsync(this IDatabaseOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListByDatabaseNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
public MeetingsController() { _context = new MongoOperations(); }
public CoursesController() { _context = new MongoOperations(); }
/// <summary> /// Begins creating a new Azure SQL Database or updating an existing /// Azure SQL Database. To determine the status of the operation call /// GetDatabaseOperationStatus. /// </summary> /// <param name='operations'> /// Reference to the Microsoft.Azure.Management.Sql.IDatabaseOperations. /// </param> /// <param name='resourceGroupName'> /// Required. The name of the Resource Group to which the Azure SQL /// Database Server belongs. /// </param> /// <param name='serverName'> /// Required. The name of the Azure SQL Database Server on which the /// database is hosted. /// </param> /// <param name='databaseName'> /// Required. The name of the Azure SQL Database to be operated on /// (Updated or created). /// </param> /// <param name='parameters'> /// Required. The required parameters for creating or updating a /// database. /// </param> /// <returns> /// Response for long running Azure Sql Database operations. /// </returns> public static Task <DatabaseCreateOrUpdateResponse> BeginCreateOrUpdateAsync(this IDatabaseOperations operations, string resourceGroupName, string serverName, string databaseName, DatabaseCreateOrUpdateParameters parameters) { return(operations.BeginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters, CancellationToken.None)); }
public CertificatesController() { _context = new MongoOperations(); }
/// <summary> /// Gets the status of an Azure Sql Database create or update operation. /// </summary> /// <param name='operations'> /// Reference to the Microsoft.Azure.Management.Sql.IDatabaseOperations. /// </param> /// <param name='operationStatusLink'> /// Required. Location value returned by the Begin operation /// </param> /// <returns> /// Response for long running Azure Sql Database operations. /// </returns> public static Task <DatabaseCreateOrUpdateResponse> GetDatabaseOperationStatusAsync(this IDatabaseOperations operations, string operationStatusLink) { return(operations.GetDatabaseOperationStatusAsync(operationStatusLink, CancellationToken.None)); }
public InstructorsController() { _context = new MongoOperations(); }
public GetMatchesToSearchFromDatabase(ILogger logger, IDatabaseOperations database) { _logger = logger; _database = database; }
public MySqlCache(IOptions <MySqlCacheOptions> options) { var cacheOptions = options.Value; if (string.IsNullOrEmpty(cacheOptions.WriteConnectionString) && string.IsNullOrEmpty(cacheOptions.ConnectionString) && string.IsNullOrEmpty(cacheOptions.ReadConnectionString)) { throw new ArgumentException($"{nameof(cacheOptions.ReadConnectionString)} and {nameof(cacheOptions.WriteConnectionString)}" + $" and {nameof(cacheOptions.ConnectionString)} cannot be empty or null at the same time."); } if (string.IsNullOrEmpty(cacheOptions.SchemaName)) { throw new ArgumentException( $"{nameof(cacheOptions.SchemaName)} cannot be empty or null."); } if (string.IsNullOrEmpty(cacheOptions.TableName)) { throw new ArgumentException( $"{nameof(cacheOptions.TableName)} cannot be empty or null."); } if (cacheOptions.ExpiredItemsDeletionInterval.HasValue && cacheOptions.ExpiredItemsDeletionInterval.Value < MinimumExpiredItemsDeletionInterval) { throw new ArgumentException( $"{nameof(cacheOptions.ExpiredItemsDeletionInterval)} cannot be less the minimum " + $"value of {MinimumExpiredItemsDeletionInterval.TotalMinutes} minutes."); } if (cacheOptions.DefaultSlidingExpiration <= TimeSpan.Zero) { throw new ArgumentOutOfRangeException( nameof(cacheOptions.DefaultSlidingExpiration), cacheOptions.DefaultSlidingExpiration, "The sliding expiration value must be positive."); } _systemClock = cacheOptions.SystemClock ?? new SystemClock(); _expiredItemsDeletionInterval = cacheOptions.ExpiredItemsDeletionInterval ?? DefaultExpiredItemsDeletionInterval; _defaultSlidingExpiration = cacheOptions.DefaultSlidingExpiration; // MySqlClient library on Mono doesn't have support for DateTimeOffset and also // it doesn't have support for apis like GetFieldValue, GetFieldValueAsync etc. // So we detect the platform to perform things differently for Mono vs. non-Mono platforms. if (PlatformHelper.IsMono) { _dbOperations = new MonoDatabaseOperations( cacheOptions.ReadConnectionString, cacheOptions.WriteConnectionString, cacheOptions.SchemaName, cacheOptions.TableName, _systemClock); } else { _dbOperations = new DatabaseOperations( cacheOptions.ReadConnectionString, cacheOptions.WriteConnectionString, cacheOptions.SchemaName, cacheOptions.TableName, _systemClock); } _deleteExpiredCachedItemsDelegateAsync = _dbOperations.DeleteExpiredCacheItemsAsync; _deleteExpiredCachedItemsDelegate = _dbOperations.DeleteExpiredCacheItems; }
/// <summary> /// Returns information about a SQL Server database event logs. /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.WindowsAzure.Management.Sql.IDatabaseOperations. /// </param> /// <param name='serverName'> /// Required. The name of the SQL Server on which the database is /// housed. /// </param> /// <param name='databaseName'> /// Required. The name of the SQL Server database to be obtained. /// </param> /// <param name='parameters'> /// Required. The parameters for the get event logs database operation. /// </param> /// <returns> /// A standard service response including an HTTP status code and /// request ID. /// </returns> public static Task <DatabaseGetEventLogsResponse> GetEventLogsAsync(this IDatabaseOperations operations, string serverName, string databaseName, DatabaseGetEventLogsParameters parameters) { return(operations.GetEventLogsAsync(serverName, databaseName, parameters, CancellationToken.None)); }
public UpdateMatchTwitterStatus(ILogger logger, IDatabaseOperations database) { _logger = logger; _database = database; }
/// <summary> /// Creates a database in a SQL Server database server. /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.WindowsAzure.Management.Sql.IDatabaseOperations. /// </param> /// <param name='serverName'> /// Required. The name of the SQL Server where the database will be /// created. /// </param> /// <param name='parameters'> /// Required. The parameters for the create database operation. /// </param> /// <returns> /// Response containing the database create response. /// </returns> public static Task <DatabaseCreateResponse> CreateAsync(this IDatabaseOperations operations, string serverName, DatabaseCreateParameters parameters) { return(operations.CreateAsync(serverName, parameters, CancellationToken.None)); }
/// <summary> /// Cancels the asynchronous operation on the database. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='resourceGroupName'> /// The name of the resource group that contains the resource. You can obtain /// this value from the Azure Resource Manager API or the portal. /// </param> /// <param name='serverName'> /// The name of the server. /// </param> /// <param name='databaseName'> /// The name of the database. /// </param> /// <param name='operationId'> /// The operation identifier. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task CancelAsync(this IDatabaseOperations operations, string resourceGroupName, string serverName, string databaseName, System.Guid operationId, CancellationToken cancellationToken = default(CancellationToken)) { (await operations.CancelWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, operationId, SqlManagementClient.SetJsonAcceptHeader(), cancellationToken).ConfigureAwait(false)).Dispose(); }
/// <summary> /// Retrieves metric definitions for the given database. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='resourceGroupName'> /// The name of the resource group. The name is case insensitive. /// </param> /// <param name='accountName'> /// Cosmos DB database account name. /// </param> /// <param name='databaseRid'> /// Cosmos DB database rid. /// </param> public static IEnumerable <MetricDefinition> ListMetricDefinitions(this IDatabaseOperations operations, string resourceGroupName, string accountName, string databaseRid) { return(operations.ListMetricDefinitionsAsync(resourceGroupName, accountName, databaseRid).GetAwaiter().GetResult()); }
/// <summary> /// Gets a list of operations performed on the database. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='nextPageLink'> /// The NextLink from the previous successful call to List operation. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <IPage <DatabaseOperation> > ListByDatabaseNextAsync(this IDatabaseOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListByDatabaseNextWithHttpMessagesAsync(nextPageLink, SqlManagementClient.SetJsonAcceptHeader(), cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
public EditController(IDatabaseOperations databaseOperations) { _databaseOperations = databaseOperations; }
/// <summary> /// Gets a list of operations performed on the database. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='resourceGroupName'> /// The name of the resource group that contains the resource. You can obtain /// this value from the Azure Resource Manager API or the portal. /// </param> /// <param name='serverName'> /// The name of the server. /// </param> /// <param name='databaseName'> /// The name of the database. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <IPage <DatabaseOperationInner> > ListByDatabaseAsync(this IDatabaseOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListByDatabaseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }