generated from NetCoreTemplates/blazor-vue
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert OrmLite APIs to use sync (for SQLite)
- Loading branch information
Showing
47 changed files
with
353 additions
and
360 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,34 @@ | ||
using MyApp.Data; | ||
using MyApp.ServiceModel; | ||
using ServiceStack; | ||
using ServiceStack.IO; | ||
using ServiceStack.Data; | ||
using ServiceStack.OrmLite; | ||
|
||
namespace MyApp.ServiceInterface; | ||
|
||
[Worker(Databases.Analytics)] | ||
public class AnalyticsTasksCommand(R2VirtualFiles r2, QuestionsProvider questions) : AsyncCommand<AnalyticsTasks> | ||
public class AnalyticsTasksCommand(IDbConnectionFactory dbFactory) : SyncCommand<AnalyticsTasks> | ||
{ | ||
protected override async Task RunAsync(AnalyticsTasks request, CancellationToken token) | ||
protected override void Run(AnalyticsTasks request) | ||
{ | ||
if (request.CreatePostStat == null && request.CreateSearchStat == null && request.DeletePost == null) | ||
return; | ||
|
||
using var analyticsDb = HostContext.AppHost.GetDbConnection(Databases.Analytics); | ||
using var analyticsDb = dbFactory.Open(Databases.Analytics); | ||
|
||
if (request.CreatePostStat != null)// && !Stats.IsAdminOrModerator(request.RecordPostView.UserName)) | ||
{ | ||
await analyticsDb.InsertAsync(request.CreatePostStat, token: token); | ||
analyticsDb.Insert(request.CreatePostStat); | ||
} | ||
|
||
if (request.CreateSearchStat != null)// && !Stats.IsAdminOrModerator(request.RecordSearchView.UserName)) | ||
{ | ||
await analyticsDb.InsertAsync(request.CreateSearchStat, token: token); | ||
analyticsDb.Insert(request.CreateSearchStat); | ||
} | ||
|
||
if (request.DeletePost != null) | ||
{ | ||
await analyticsDb.DeleteAsync<PostStat>(x => x.PostId == request.DeletePost, token: token); | ||
analyticsDb.Delete<PostStat>(x => x.PostId == request.DeletePost); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.