File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed
backend/FwLite/LcmDebugger Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change 1111using Refit ;
1212using SIL . Harmony ;
1313using SIL . Harmony . Core ;
14+ using Microsoft . Extensions . Logging ;
1415
1516var builder = Host . CreateApplicationBuilder ( ) ;
1617//slows down import to log all sql.
4546var fwDataFactory = app . Services . GetRequiredService < FwDataFactory > ( ) ;
4647// var miniLcmApi = fwDataFactory.GetFwDataMiniLcmApi(fwDataProject, false);
4748// var entries = await miniLcmApi.GetEntries().ToArrayAsync();
48-
49+ // var entries = miniLcmApi.GetEntries(new(Filter: new() { GridifyFilter = "LexemeForm[sbe]=ta" })).ToArrayAsync();
50+ // var entry = Utils.GetLexEntry(app.Services, fwDataProject, new Guid("{018d71a9-12c2-4129-be8a-35fe246afda2}"));
4951
5052fwDataFactory . Dispose ( ) ;
Original file line number Diff line number Diff line change 1+ using FwDataMiniLcmBridge ;
2+ using FwDataMiniLcmBridge . LcmUtils ;
3+ using Microsoft . Extensions . DependencyInjection ;
4+ using SIL . LCModel ;
5+
6+ namespace LcmDebugger ;
7+
8+ public static class Utils
9+ {
10+ public static LcmCache ? LoadProject ( this IServiceProvider services , FwDataProject project )
11+ {
12+ var projectLoader = services . GetRequiredService < IProjectLoader > ( ) ;
13+ var projectService = projectLoader . LoadCache ( project ) ;
14+ return projectService ;
15+ }
16+
17+ public static ILexEntry GetLexEntry ( this IServiceProvider services , FwDataProject project , Guid entryId )
18+ {
19+ var cache = LoadProject ( services , project ) ?? throw new InvalidOperationException ( "Project not found." ) ;
20+ var entryRepo = cache . ServiceLocator . GetInstance < ILexEntryRepository > ( ) ?? throw new InvalidOperationException ( "Entry repository not found." ) ;
21+ return entryRepo . GetObject ( entryId ) ?? throw new InvalidOperationException ( message : "Entry not found." ) ;
22+ }
23+ }
You can’t perform that action at this time.
0 commit comments