Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public async Task<List<string>> GetRolesAsync(IdentityUser user)
{
if (Config.DataConfig.DatabaseType == DatabaseTypes.Postgres)
{
var query = $@"SELECT anr.name FROM aspnetuserroles anur
var query = @"SELECT anr.name FROM aspnetuserroles anur
INNER JOIN aspnetroles anr ON anur.roleid = anr.id
WHERE anur.userid = @userId";

Expand All @@ -31,7 +31,7 @@ public async Task<List<string>> GetRolesAsync(IdentityUser user)
}
else
{
var query = $@"SELECT anr.Name FROM AspNetUserRoles anur
var query = @"SELECT anr.Name FROM AspNetUserRoles anur
INNER JOIN AspNetRoles anr ON anur.RoleId = anr.Id
WHERE anur.UserId = @userId";

Expand All @@ -49,7 +49,7 @@ public async Task<IdentityUser> FindByIdAsync(string userId)
{
if (Config.DataConfig.DatabaseType == DatabaseTypes.Postgres)
{
var query = $@"SELECT * FROM aspnetusers WHERE id = @userId";
var query = @"SELECT * FROM aspnetusers WHERE id = @userId";

using (IDbConnection db = new NpgsqlConnection(DataConfig.CoreConnectionString))
{
Expand All @@ -58,7 +58,7 @@ public async Task<IdentityUser> FindByIdAsync(string userId)
}
else
{
var query = $@"SELECT * FROM AspNetUsers WHERE Id = @userId";
var query = @"SELECT * FROM AspNetUsers WHERE Id = @userId";

using (IDbConnection db = new SqlConnection(DataConfig.CoreConnectionString))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ public async Task<IEnumerable<ScheduledTaskLog>> GetAllLogForDateAsync(DateTime
{
using (IDbConnection db = new NpgsqlConnection(DataConfig.CoreConnectionString))
{
return (await db.QueryAsync<ScheduledTaskLog>($"SELECT * FROM scheduledtasklogs WHERE CAST(rundate AS DATE) = CAST(@timeStamp AS DATE)", new { timeStamp = timeStamp })).ToList();
return (await db.QueryAsync<ScheduledTaskLog>("SELECT * FROM scheduledtasklogs WHERE CAST(rundate AS DATE) = CAST(@timeStamp AS DATE)", new { timeStamp = timeStamp })).ToList();
}
}
else
{
using (IDbConnection db = new SqlConnection(DataConfig.CoreConnectionString))
{
return await db.QueryAsync<ScheduledTaskLog>($"SELECT * FROM ScheduledTaskLogs WHERE CAST(RunDate AS DATE) = CAST(@timeStamp AS DATE)", new { timeStamp = timeStamp });
return await db.QueryAsync<ScheduledTaskLog>("SELECT * FROM ScheduledTaskLogs WHERE CAST(RunDate AS DATE) = CAST(@timeStamp AS DATE)", new { timeStamp = timeStamp });
}
}
}
Expand All @@ -77,15 +77,15 @@ public async Task<ScheduledTaskLog> GetLogForTaskAndDateAsync(int scheduledTaskI
{
using (IDbConnection db = new NpgsqlConnection(DataConfig.CoreConnectionString))
{
var items = await db.QueryAsync<ScheduledTaskLog>($"SELECT * FROM scheduledtasklogs WHERE scheduledtaskid = @scheduledTaskId AND CAST(rundate AS DATE) = CAST(@timeStamp AS DATE)", new { scheduledTaskId = scheduledTaskId, timeStamp = timeStamp });
var items = await db.QueryAsync<ScheduledTaskLog>("SELECT * FROM scheduledtasklogs WHERE scheduledtaskid = @scheduledTaskId AND CAST(rundate AS DATE) = CAST(@timeStamp AS DATE)", new { scheduledTaskId = scheduledTaskId, timeStamp = timeStamp });
return items.FirstOrDefault();
}
}
else
{
using (IDbConnection db = new SqlConnection(DataConfig.CoreConnectionString))
{
var items = await db.QueryAsync<ScheduledTaskLog>($"SELECT * FROM ScheduledTaskLogs WHERE ScheduledTaskId = @scheduledTaskId AND CAST(RunDate AS DATE) = CAST(@timeStamp AS DATE)", new { scheduledTaskId = scheduledTaskId, timeStamp = timeStamp });
var items = await db.QueryAsync<ScheduledTaskLog>("SELECT * FROM ScheduledTaskLogs WHERE ScheduledTaskId = @scheduledTaskId AND CAST(RunDate AS DATE) = CAST(@timeStamp AS DATE)", new { scheduledTaskId = scheduledTaskId, timeStamp = timeStamp });
return items.FirstOrDefault();
}
}
Expand Down
2 changes: 1 addition & 1 deletion Tools/Resgrid.Console/Commands/DbUpdateCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ private static IServiceProvider CreateServices()
// Add SQL Server support to FluentMigrator
.AddSqlServer()
// Set the connection string
.WithGlobalConnectionString(System.Configuration.ConfigurationManager.ConnectionStrings["ResgridContext"].ConnectionString)
.WithGlobalConnectionString(Config.DataConfig.CoreConnectionString)
// Define the assembly containing the migrations
.ScanIn(typeof(M0001_InitialMigration).Assembly).For.Migrations().For.EmbeddedResources())
// Enable logging to console in the FluentMigrator way
Expand Down
2 changes: 1 addition & 1 deletion Workers/Resgrid.Workers.Console/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ private static IServiceProvider CreateServices()
// Add SQL Server support to FluentMigrator
.AddSqlServer()
// Set the connection string
.WithGlobalConnectionString(System.Configuration.ConfigurationManager.ConnectionStrings["ResgridContext"].ConnectionString)
.WithGlobalConnectionString(Config.DataConfig.CoreConnectionString)
// Define the assembly containing the migrations
.ScanIn(typeof(M0001_InitialMigration).Assembly).For.Migrations().For.EmbeddedResources())
// Enable logging to console in the FluentMigrator way
Expand Down
Loading