1
- using GraphQL . Server ;
2
- using MediatR ;
1
+ using GraphQL . MicrosoftDI ;
3
2
using Microsoft . AspNetCore . Builder ;
4
3
using Microsoft . Extensions . Configuration ;
5
4
using Microsoft . Extensions . DependencyInjection ;
6
- using VirtoCommerce . Xapi . Core . Extensions ;
7
- using VirtoCommerce . Xapi . Core . Infrastructure ;
8
5
using VirtoCommerce . Platform . Core . Modularity ;
9
6
using VirtoCommerce . Platform . Core . Security ;
7
+ using VirtoCommerce . Xapi . Core . Extensions ;
10
8
using { Namespace } . Core ;
11
9
using { Namespace } . Data ;
12
10
@@ -19,19 +17,18 @@ public class Module : IModule, IHasConfiguration
19
17
20
18
public void Initialize ( IServiceCollection serviceCollection )
21
19
{
22
- var assemblyMarker = typeof ( AssemblyMarker ) ;
23
- var graphQlBuilder = new CustomGraphQLBuilder ( serviceCollection ) ;
24
- graphQlBuilder . AddGraphTypes ( assemblyMarker ) ;
25
- serviceCollection . AddMediatR ( assemblyMarker ) ;
26
- serviceCollection . AddAutoMapper ( assemblyMarker ) ;
27
- serviceCollection . AddSchemaBuilders ( assemblyMarker ) ;
28
-
29
20
// Override models
30
21
//AbstractTypeFactory<OriginalModel>.OverrideType<OriginalModel, ExtendedModel>().MapToType<ExtendedEntity>();
31
22
//AbstractTypeFactory<OriginalEntity>.OverrideType<OriginalEntity, ExtendedEntity>();
32
23
33
24
// Register services
34
25
//serviceCollection.AddTransient<IMyService, MyService>();
26
+
27
+ // Register GraphQL schema
28
+ _ = new GraphQLBuilder ( serviceCollection , builder =>
29
+ {
30
+ builder . AddSchema ( serviceCollection , typeof ( AssemblyMarker ) ) ;
31
+ } ) ;
35
32
}
36
33
37
34
public void PostInitialize ( IApplicationBuilder appBuilder )
@@ -41,6 +38,9 @@ public void PostInitialize(IApplicationBuilder appBuilder)
41
38
// Register permissions
42
39
var permissionsRegistrar = serviceProvider . GetRequiredService < IPermissionsRegistrar > ( ) ;
43
40
permissionsRegistrar . RegisterPermissions ( ModuleInfo . Id , "{ModuleName}" , ModuleConstants . Security . Permissions . AllPermissions ) ;
41
+
42
+ // Register partial GraphQL schema
43
+ appBuilder . UseScopedSchema < AssemblyMarker > ( "{KebabModuleName}" ) ;
44
44
}
45
45
46
46
public void Uninstall ( )
0 commit comments