UseInMemory
Adds in-memory database support for testing and development. No external database required. Data is lost when the application shuts down.
Signature
public static TraxEffectBuilderWithData UseInMemory(
this TraxEffectBuilder effectBuilder
)Parameters
None.
Returns
TraxEffectBuilderWithData — a subclass of TraxEffectBuilder that unlocks data-dependent methods like AddDataContextLogging. This provides compile-time safety: methods that require a data provider are only available on the returned type.
Example
services.AddTrax(trax => trax
.AddEffects(effects => effects
.UseInMemory()
)
.AddMediator(typeof(Program).Assembly)
);Remarks
- Suitable for unit/integration testing and local development.
- Data does not persist between application restarts.
- Registers an
IDataContextbacked by an in-memory EF Core provider. - For production use, use UsePostgres instead.
Package
dotnet add package Trax.Effect.Data.InMemory