@@ -104,6 +104,29 @@ public OpenIddictCoreBuilder ReplaceApplicationStore<
104104 return this ;
105105 }
106106
107+ /// <summary>
108+ /// Replaces the application store by the specified type.
109+ /// </summary>
110+ /// <remarks>
111+ /// Note: the specified type MUST be an open generic type definition containing exactly one generic argument.
112+ /// </remarks>
113+ /// <param name="type">The type of the store.</param>
114+ /// <param name="lifetime">The lifetime of the store.</param>
115+ /// <returns>The <see cref="OpenIddictCoreBuilder"/> instance.</returns>
116+ public OpenIddictCoreBuilder ReplaceApplicationStore (
117+ [ DynamicallyAccessedMembers ( DynamicallyAccessedMemberTypes . PublicConstructors ) ] Type type ,
118+ ServiceLifetime lifetime = ServiceLifetime . Scoped )
119+ {
120+ if ( ! type . IsGenericTypeDefinition || type . GetGenericArguments ( ) is not { Length : 1 } )
121+ {
122+ throw new ArgumentException ( SR . GetResourceString ( SR . ID0232 ) , nameof ( type ) ) ;
123+ }
124+
125+ Services . Replace ( ServiceDescriptor . Describe ( typeof ( IOpenIddictApplicationStore < > ) , type , lifetime ) ) ;
126+
127+ return this ;
128+ }
129+
107130 /// <summary>
108131 /// Replaces the authorization manager by the specified type.
109132 /// </summary>
@@ -161,6 +184,29 @@ public OpenIddictCoreBuilder ReplaceAuthorizationStore<
161184 return this ;
162185 }
163186
187+ /// <summary>
188+ /// Replaces the authorization store by the specified type.
189+ /// </summary>
190+ /// <remarks>
191+ /// Note: the specified type MUST be an open generic type definition containing exactly one generic argument.
192+ /// </remarks>
193+ /// <param name="type">The type of the store.</param>
194+ /// <param name="lifetime">The lifetime of the store.</param>
195+ /// <returns>The <see cref="OpenIddictCoreBuilder"/> instance.</returns>
196+ public OpenIddictCoreBuilder ReplaceAuthorizationStore (
197+ [ DynamicallyAccessedMembers ( DynamicallyAccessedMemberTypes . PublicConstructors ) ] Type type ,
198+ ServiceLifetime lifetime = ServiceLifetime . Scoped )
199+ {
200+ if ( ! type . IsGenericTypeDefinition || type . GetGenericArguments ( ) is not { Length : 1 } )
201+ {
202+ throw new ArgumentException ( SR . GetResourceString ( SR . ID0232 ) , nameof ( type ) ) ;
203+ }
204+
205+ Services . Replace ( ServiceDescriptor . Describe ( typeof ( IOpenIddictAuthorizationStore < > ) , type , lifetime ) ) ;
206+
207+ return this ;
208+ }
209+
164210 /// <summary>
165211 /// Replaces the scope manager by the specified type.
166212 /// </summary>
@@ -218,6 +264,29 @@ public OpenIddictCoreBuilder ReplaceScopeStore<
218264 return this ;
219265 }
220266
267+ /// <summary>
268+ /// Replaces the scope store by the specified type.
269+ /// </summary>
270+ /// <remarks>
271+ /// Note: the specified type MUST be an open generic type definition containing exactly one generic argument.
272+ /// </remarks>
273+ /// <param name="type">The type of the store.</param>
274+ /// <param name="lifetime">The lifetime of the store.</param>
275+ /// <returns>The <see cref="OpenIddictCoreBuilder"/> instance.</returns>
276+ public OpenIddictCoreBuilder ReplaceScopeStore (
277+ [ DynamicallyAccessedMembers ( DynamicallyAccessedMemberTypes . PublicConstructors ) ] Type type ,
278+ ServiceLifetime lifetime = ServiceLifetime . Scoped )
279+ {
280+ if ( ! type . IsGenericTypeDefinition || type . GetGenericArguments ( ) is not { Length : 1 } )
281+ {
282+ throw new ArgumentException ( SR . GetResourceString ( SR . ID0232 ) , nameof ( type ) ) ;
283+ }
284+
285+ Services . Replace ( ServiceDescriptor . Describe ( typeof ( IOpenIddictScopeStore < > ) , type , lifetime ) ) ;
286+
287+ return this ;
288+ }
289+
221290 /// <summary>
222291 /// Replaces the token manager by the specified type.
223292 /// </summary>
@@ -275,6 +344,29 @@ public OpenIddictCoreBuilder ReplaceTokenStore<
275344 return this ;
276345 }
277346
347+ /// <summary>
348+ /// Replaces the token store by the specified type.
349+ /// </summary>
350+ /// <remarks>
351+ /// Note: the specified type MUST be an open generic type definition containing exactly one generic argument.
352+ /// </remarks>
353+ /// <param name="type">The type of the store.</param>
354+ /// <param name="lifetime">The lifetime of the store.</param>
355+ /// <returns>The <see cref="OpenIddictCoreBuilder"/> instance.</returns>
356+ public OpenIddictCoreBuilder ReplaceTokenStore (
357+ [ DynamicallyAccessedMembers ( DynamicallyAccessedMemberTypes . PublicConstructors ) ] Type type ,
358+ ServiceLifetime lifetime = ServiceLifetime . Scoped )
359+ {
360+ if ( ! type . IsGenericTypeDefinition || type . GetGenericArguments ( ) is not { Length : 1 } )
361+ {
362+ throw new ArgumentException ( SR . GetResourceString ( SR . ID0232 ) , nameof ( type ) ) ;
363+ }
364+
365+ Services . Replace ( ServiceDescriptor . Describe ( typeof ( IOpenIddictTokenStore < > ) , type , lifetime ) ) ;
366+
367+ return this ;
368+ }
369+
278370 /// <summary>
279371 /// Disables additional filtering so that the OpenIddict managers don't execute a second check
280372 /// to ensure the results returned by the stores exactly match the specified query filters,
0 commit comments