77using JsonApiDotNetCore . QueryStrings ;
88using JsonApiDotNetCore . Repositories ;
99using JsonApiDotNetCore . Resources ;
10- using JsonApiDotNetCore . Serialization . JsonConverters ;
1110using JsonApiDotNetCore . Serialization . Request ;
1211using JsonApiDotNetCore . Serialization . Request . Adapters ;
1312using JsonApiDotNetCore . Serialization . Response ;
@@ -74,6 +73,8 @@ public void ConfigureResourceGraph(ICollection<Type> dbContextTypes, Action<Reso
7473 _services . TryAddSingleton ( serviceProvider =>
7574 {
7675 var loggerFactory = serviceProvider . GetRequiredService < ILoggerFactory > ( ) ;
76+ var events = serviceProvider . GetRequiredService < IJsonApiApplicationBuilderEvents > ( ) ;
77+
7778 var resourceGraphBuilder = new ResourceGraphBuilder ( _options , loggerFactory ) ;
7879
7980 var scanner = new ResourcesAssemblyScanner ( _assemblyCache , resourceGraphBuilder ) ;
@@ -93,8 +94,7 @@ public void ConfigureResourceGraph(ICollection<Type> dbContextTypes, Action<Reso
9394 configureResourceGraph ? . Invoke ( resourceGraphBuilder ) ;
9495
9596 IResourceGraph resourceGraph = resourceGraphBuilder . Build ( ) ;
96-
97- _options . SerializerOptions . Converters . Add ( new ResourceObjectConverter ( resourceGraph ) ) ;
97+ events . ResourceGraphBuilt ( resourceGraph ) ;
9898
9999 return resourceGraph ;
100100 } ) ;
@@ -169,6 +169,7 @@ public void ConfigureServiceContainer(ICollection<Type> dbContextTypes)
169169 _services . TryAddScoped < IQueryLayerComposer , QueryLayerComposer > ( ) ;
170170 _services . TryAddScoped < IInverseNavigationResolver , InverseNavigationResolver > ( ) ;
171171 _services . TryAddSingleton < IDocumentDescriptionLinkProvider , NoDocumentDescriptionLinkProvider > ( ) ;
172+ _services . TryAddSingleton < IJsonApiApplicationBuilderEvents , DefaultJsonApiApplicationBuilderEvents > ( ) ;
172173 }
173174
174175 private void AddMiddlewareLayer ( )
0 commit comments