22using System . Collections . Generic ;
33using System . Linq ;
44using System . Reflection ;
5+ using System . Threading . Tasks ;
56using Customers . Pn . Abstractions ;
67using Customers . Pn . Infrastructure . Data . Seed ;
78using Customers . Pn . Infrastructure . Data . Seed . Data ;
@@ -251,7 +252,7 @@ public PluginPermissionsManager GetPermissionsManager(string connectionString)
251252 return new PluginPermissionsManager ( context ) ;
252253 }
253254
254- private async void SeedCustomersEntityGroup ( IServiceCollection serviceCollection )
255+ private async Task SeedCustomersEntityGroup ( IServiceCollection serviceCollection )
255256 {
256257 var serviceProvider = serviceCollection . BuildServiceProvider ( ) ;
257258 var pluginDbOptions = serviceProvider . GetRequiredService < IPluginDbOptions < CustomersSettings > > ( ) ;
@@ -261,30 +262,32 @@ private async void SeedCustomersEntityGroup(IServiceCollection serviceCollection
261262 var core = await serviceProvider . GetRequiredService < IEFormCoreService > ( ) . GetCore ( ) ;
262263 var context = serviceProvider . GetRequiredService < CustomersPnDbAnySql > ( ) ;
263264
264-
265265 EntityGroupList model = await core . Advanced_EntityGroupAll (
266266 "id" ,
267267 "eform-angular-basecustomer-plugin-Customers-hidden" ,
268268 0 , 1 , Constants . FieldTypes . EntitySearch ,
269269 false ,
270270 Constants . WorkflowStates . NotRemoved ) ;
271271
272- EntityGroup group ;
273-
274272 if ( ! model . EntityGroups . Any ( ) )
275273 {
276- group = await core . EntityGroupCreate ( Constants . FieldTypes . EntitySearch ,
277- "eform-angular-basecustomer-plugin-Customers-hidden" , "" , true , false ) ;
274+ var group = await core . EntityGroupCreate ( Constants . FieldTypes . EntitySearch ,
275+ "eform-angular-basecustomer-plugin-Customers-hidden" , "" , true , true ) ;
276+
277+ await pluginDbOptions . UpdateDb (
278+ settings => settings . RelatedEntityGroupId = int . Parse ( group . MicrotingUid ) ,
279+ context ,
280+ 1 ) ;
278281 }
279282 else
280283 {
281- group = model . EntityGroups . First ( ) ;
282- }
284+ var group = model . EntityGroups . First ( ) ;
283285
284- await pluginDbOptions . UpdateDb (
285- settings => settings . RelatedEntityGroupId = int . Parse ( group . MicrotingUUID ) ,
286- context ,
287- 1 ) ;
286+ await pluginDbOptions . UpdateDb (
287+ settings => settings . RelatedEntityGroupId = int . Parse ( group . MicrotingUUID ) ,
288+ context ,
289+ 1 ) ;
290+ }
288291 }
289292 }
290293 }
0 commit comments