mirror of
https://github.com/bitwarden/server.git
synced 2026-02-02 23:23:15 +08:00
Turn on file scoped namespaces (#2225)
This commit is contained in:
@@ -5,55 +5,54 @@ using Bit.Core.Repositories;
|
||||
using Bit.Core.Settings;
|
||||
using Dapper;
|
||||
|
||||
namespace Bit.Infrastructure.Dapper.Repositories
|
||||
namespace Bit.Infrastructure.Dapper.Repositories;
|
||||
|
||||
public class SsoConfigRepository : Repository<SsoConfig, long>, ISsoConfigRepository
|
||||
{
|
||||
public class SsoConfigRepository : Repository<SsoConfig, long>, ISsoConfigRepository
|
||||
public SsoConfigRepository(GlobalSettings globalSettings)
|
||||
: this(globalSettings.SqlServer.ConnectionString, globalSettings.SqlServer.ReadOnlyConnectionString)
|
||||
{ }
|
||||
|
||||
public SsoConfigRepository(string connectionString, string readOnlyConnectionString)
|
||||
: base(connectionString, readOnlyConnectionString)
|
||||
{ }
|
||||
|
||||
public async Task<SsoConfig> GetByOrganizationIdAsync(Guid organizationId)
|
||||
{
|
||||
public SsoConfigRepository(GlobalSettings globalSettings)
|
||||
: this(globalSettings.SqlServer.ConnectionString, globalSettings.SqlServer.ReadOnlyConnectionString)
|
||||
{ }
|
||||
|
||||
public SsoConfigRepository(string connectionString, string readOnlyConnectionString)
|
||||
: base(connectionString, readOnlyConnectionString)
|
||||
{ }
|
||||
|
||||
public async Task<SsoConfig> GetByOrganizationIdAsync(Guid organizationId)
|
||||
using (var connection = new SqlConnection(ConnectionString))
|
||||
{
|
||||
using (var connection = new SqlConnection(ConnectionString))
|
||||
{
|
||||
var results = await connection.QueryAsync<SsoConfig>(
|
||||
$"[{Schema}].[{Table}_ReadByOrganizationId]",
|
||||
new { OrganizationId = organizationId },
|
||||
commandType: CommandType.StoredProcedure);
|
||||
var results = await connection.QueryAsync<SsoConfig>(
|
||||
$"[{Schema}].[{Table}_ReadByOrganizationId]",
|
||||
new { OrganizationId = organizationId },
|
||||
commandType: CommandType.StoredProcedure);
|
||||
|
||||
return results.SingleOrDefault();
|
||||
}
|
||||
return results.SingleOrDefault();
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<SsoConfig> GetByIdentifierAsync(string identifier)
|
||||
public async Task<SsoConfig> GetByIdentifierAsync(string identifier)
|
||||
{
|
||||
using (var connection = new SqlConnection(ConnectionString))
|
||||
{
|
||||
using (var connection = new SqlConnection(ConnectionString))
|
||||
{
|
||||
var results = await connection.QueryAsync<SsoConfig>(
|
||||
$"[{Schema}].[{Table}_ReadByIdentifier]",
|
||||
new { Identifier = identifier },
|
||||
commandType: CommandType.StoredProcedure);
|
||||
var results = await connection.QueryAsync<SsoConfig>(
|
||||
$"[{Schema}].[{Table}_ReadByIdentifier]",
|
||||
new { Identifier = identifier },
|
||||
commandType: CommandType.StoredProcedure);
|
||||
|
||||
return results.SingleOrDefault();
|
||||
}
|
||||
return results.SingleOrDefault();
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<ICollection<SsoConfig>> GetManyByRevisionNotBeforeDate(DateTime? notBefore)
|
||||
public async Task<ICollection<SsoConfig>> GetManyByRevisionNotBeforeDate(DateTime? notBefore)
|
||||
{
|
||||
using (var connection = new SqlConnection(ConnectionString))
|
||||
{
|
||||
using (var connection = new SqlConnection(ConnectionString))
|
||||
{
|
||||
var results = await connection.QueryAsync<SsoConfig>(
|
||||
$"[{Schema}].[{Table}_ReadManyByNotBeforeRevisionDate]",
|
||||
new { NotBefore = notBefore },
|
||||
commandType: CommandType.StoredProcedure);
|
||||
var results = await connection.QueryAsync<SsoConfig>(
|
||||
$"[{Schema}].[{Table}_ReadManyByNotBeforeRevisionDate]",
|
||||
new { NotBefore = notBefore },
|
||||
commandType: CommandType.StoredProcedure);
|
||||
|
||||
return results.ToList();
|
||||
}
|
||||
return results.ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user