Revert filescoped (#2227)

* Revert "Add git blame entry (#2226)"

This reverts commit 239286737d.

* Revert "Turn on file scoped namespaces (#2225)"

This reverts commit 34fb4cca2a.
This commit is contained in:
Justin Baur
2022-08-29 15:53:48 -04:00
committed by GitHub
parent 239286737d
commit bae03feffe
1208 changed files with 74317 additions and 73126 deletions

View File

@@ -6,92 +6,93 @@ using Bit.Core.Repositories;
using Bit.Core.Settings;
using Dapper;
namespace Bit.Infrastructure.Dapper.Repositories;
public class OrganizationRepository : Repository<Organization, Guid>, IOrganizationRepository
namespace Bit.Infrastructure.Dapper.Repositories
{
public OrganizationRepository(GlobalSettings globalSettings)
: this(globalSettings.SqlServer.ConnectionString, globalSettings.SqlServer.ReadOnlyConnectionString)
{ }
public OrganizationRepository(string connectionString, string readOnlyConnectionString)
: base(connectionString, readOnlyConnectionString)
{ }
public async Task<Organization> GetByIdentifierAsync(string identifier)
public class OrganizationRepository : Repository<Organization, Guid>, IOrganizationRepository
{
using (var connection = new SqlConnection(ConnectionString))
{
var results = await connection.QueryAsync<Organization>(
"[dbo].[Organization_ReadByIdentifier]",
new { Identifier = identifier },
commandType: CommandType.StoredProcedure);
public OrganizationRepository(GlobalSettings globalSettings)
: this(globalSettings.SqlServer.ConnectionString, globalSettings.SqlServer.ReadOnlyConnectionString)
{ }
return results.SingleOrDefault();
public OrganizationRepository(string connectionString, string readOnlyConnectionString)
: base(connectionString, readOnlyConnectionString)
{ }
public async Task<Organization> GetByIdentifierAsync(string identifier)
{
using (var connection = new SqlConnection(ConnectionString))
{
var results = await connection.QueryAsync<Organization>(
"[dbo].[Organization_ReadByIdentifier]",
new { Identifier = identifier },
commandType: CommandType.StoredProcedure);
return results.SingleOrDefault();
}
}
}
public async Task<ICollection<Organization>> GetManyByEnabledAsync()
{
using (var connection = new SqlConnection(ConnectionString))
public async Task<ICollection<Organization>> GetManyByEnabledAsync()
{
var results = await connection.QueryAsync<Organization>(
"[dbo].[Organization_ReadByEnabled]",
commandType: CommandType.StoredProcedure);
using (var connection = new SqlConnection(ConnectionString))
{
var results = await connection.QueryAsync<Organization>(
"[dbo].[Organization_ReadByEnabled]",
commandType: CommandType.StoredProcedure);
return results.ToList();
return results.ToList();
}
}
}
public async Task<ICollection<Organization>> GetManyByUserIdAsync(Guid userId)
{
using (var connection = new SqlConnection(ConnectionString))
public async Task<ICollection<Organization>> GetManyByUserIdAsync(Guid userId)
{
var results = await connection.QueryAsync<Organization>(
"[dbo].[Organization_ReadByUserId]",
new { UserId = userId },
commandType: CommandType.StoredProcedure);
using (var connection = new SqlConnection(ConnectionString))
{
var results = await connection.QueryAsync<Organization>(
"[dbo].[Organization_ReadByUserId]",
new { UserId = userId },
commandType: CommandType.StoredProcedure);
return results.ToList();
return results.ToList();
}
}
}
public async Task<ICollection<Organization>> SearchAsync(string name, string userEmail, bool? paid,
int skip, int take)
{
using (var connection = new SqlConnection(ReadOnlyConnectionString))
public async Task<ICollection<Organization>> SearchAsync(string name, string userEmail, bool? paid,
int skip, int take)
{
var results = await connection.QueryAsync<Organization>(
"[dbo].[Organization_Search]",
new { Name = name, UserEmail = userEmail, Paid = paid, Skip = skip, Take = take },
commandType: CommandType.StoredProcedure,
commandTimeout: 120);
using (var connection = new SqlConnection(ReadOnlyConnectionString))
{
var results = await connection.QueryAsync<Organization>(
"[dbo].[Organization_Search]",
new { Name = name, UserEmail = userEmail, Paid = paid, Skip = skip, Take = take },
commandType: CommandType.StoredProcedure,
commandTimeout: 120);
return results.ToList();
return results.ToList();
}
}
}
public async Task UpdateStorageAsync(Guid id)
{
using (var connection = new SqlConnection(ConnectionString))
public async Task UpdateStorageAsync(Guid id)
{
await connection.ExecuteAsync(
"[dbo].[Organization_UpdateStorage]",
new { Id = id },
commandType: CommandType.StoredProcedure,
commandTimeout: 180);
using (var connection = new SqlConnection(ConnectionString))
{
await connection.ExecuteAsync(
"[dbo].[Organization_UpdateStorage]",
new { Id = id },
commandType: CommandType.StoredProcedure,
commandTimeout: 180);
}
}
}
public async Task<ICollection<OrganizationAbility>> GetManyAbilitiesAsync()
{
using (var connection = new SqlConnection(ConnectionString))
public async Task<ICollection<OrganizationAbility>> GetManyAbilitiesAsync()
{
var results = await connection.QueryAsync<OrganizationAbility>(
"[dbo].[Organization_ReadAbilities]",
commandType: CommandType.StoredProcedure);
using (var connection = new SqlConnection(ConnectionString))
{
var results = await connection.QueryAsync<OrganizationAbility>(
"[dbo].[Organization_ReadAbilities]",
commandType: CommandType.StoredProcedure);
return results.ToList();
return results.ToList();
}
}
}
}