Path: redb/redb.Core/Extensions/RedbServiceCollectionExtensions.cs
Snapshot: redb, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb
Page: https://redbase.app/src/dev-2026-12-06/redb/redb.Core/Extensions/RedbServiceCollectionExtensions.cs
----
using Microsoft.Extensions.DependencyInjection;
namespace redb.Core.Extensions;
///
/// Extension methods for registering REDB services.
///
public static class RedbServiceCollectionExtensions
{
///
/// Registers REDB OpenSource services with the specified database provider.
///
///
/// services.AddRedb(options => options
/// .UsePostgres(connectionString)
/// .Configure(c => c.EnablePropsCache = true));
///
/// The service collection.
/// Action to configure REDB options including database provider.
/// The service collection for chaining.
public static IServiceCollection AddRedb(
this IServiceCollection services,
Action configure)
{
var builder = new RedbOptionsBuilder(services);
var infrastructure = (IRedbOptionsBuilderInfrastructure)builder;
infrastructure.IsPro = false;
configure(builder);
infrastructure.Build();
return services;
}
}