Rystem.RepositoryFramework.Infrastructure.InMemory 6.0.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package Rystem.RepositoryFramework.Infrastructure.InMemory --version 6.0.3
                    
NuGet\Install-Package Rystem.RepositoryFramework.Infrastructure.InMemory -Version 6.0.3
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Rystem.RepositoryFramework.Infrastructure.InMemory" Version="6.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Rystem.RepositoryFramework.Infrastructure.InMemory" Version="6.0.3" />
                    
Directory.Packages.props
<PackageReference Include="Rystem.RepositoryFramework.Infrastructure.InMemory" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Rystem.RepositoryFramework.Infrastructure.InMemory --version 6.0.3
                    
#r "nuget: Rystem.RepositoryFramework.Infrastructure.InMemory, 6.0.3"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Rystem.RepositoryFramework.Infrastructure.InMemory@6.0.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Rystem.RepositoryFramework.Infrastructure.InMemory&version=6.0.3
                    
Install as a Cake Addin
#tool nuget:?package=Rystem.RepositoryFramework.Infrastructure.InMemory&version=6.0.3
                    
Install as a Cake Tool

What is Rystem?

In memory integration by default

With this library you can add in memory integration with the chance to create random data with random values, random based on regular expressions and delegated methods

How to populate with random data?

Simple random (example)

Populate your in memory storage with 120 users

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddRepository<IperUser, string>(repositoryBuilder =>
{
    repositoryBuilder
        .WithInMemory(inMemoryBuilder =>
        {
            inMemoryBuilder
                .PopulateWithRandomData(120, 5)
                .WithPattern(x => x.Value.Email, @"[a-z]{5,10}@gmail\.com");
        });
    repositoryBuilder
        .AddBusiness()
            .AddBusinessBeforeInsert<IperRepositoryBeforeInsertBusiness>();
    repositoryBuilder
        .Translate<IperUser>();
});

and in app after build during startup of your application

var app = builder.Build();
await app.Services.WarmUpAsync();
Simple random with regex (example)

Populate your in memory storage with 100 users and property Email with a random regex @"[a-z]{4,10}@gmail.com"

.AddRepository<User, string>(builder => {
    builder
        .WithInMemory(inMemoryBuilder => {
            inMemoryBuilder
                .PopulateWithRandomData(100)
                .WithPattern(x => x.Email, @"[a-z]{4,10}@gmail\.com")
        });
});

and in app after build during startup of your application

var app = builder.Build();
await app.Services.WarmUpAsync();
Where can I use the regex pattern?

You can use regex pattern on all primitives type and most used structs.

Complete list:
int, uint, byte, sbyte, short, ushort, long, ulong, nint, nuint, float, double, decimal, bool, char, Guid, DateTime, TimeSpan, Range, string, int?, uint?, byte?, sbyte?, short?, ushort?, long?, ulong?, nint?, nuint?, float?, double?, decimal?, bool?, char?, Guid?, DateTime?, TimeSpan?, Range?, string?

You can use the pattern in Class, IEnumerable, IDictionary, or Array, and in everything that extends IEnumerable or IDictionary

Important!! You can override regex service in your DI

public static IServiceCollection AddRegexService<T>(
        this IServiceCollection services)
        where T : class, IRegexService
IEnumerable or Array one-dimension (example)

You have your model x (User) that has a property Groups as IEnumerable or something that extends IEnumerable, Groups is a class with a property Id as string. In the code below you are creating a list of class Groups with 8 elements in each 100 User instances, in each element of Groups you randomize based on this regex "[a-z]{4,5}". You may take care of use First() linq method to set correctly the Id property.

.AddRepository<User, string>(builder => {
    builder
        .WithInMemory(inMemoryBuilder => {
            inMemoryBuilder
                .PopulateWithRandomData(100, 8)
                .WithPattern(x => x.Groups!.First().Id, "[a-z]{4,5}");
        });
});

and in app after build during startup of your application

var app = builder.Build();
await app.Services.WarmUpAsync();
IDictionary (example)

Similar to IEnumerable population you may populate your Claims property (a dictionary) with random key but with values based on regular expression "[a-z]{4,5}". As well as IEnumerable implementation you will have 6 elements (because I choose to create 6 elements in Populate method)

.AddRepository<User, string>(builder => {
    builder
        .WithInMemory(inMemoryBuilder => {
            inMemoryBuilder
                .PopulateWithRandomData(100, 6)
                .WithPattern(x => x.Claims!.First().Value, "[a-z]{4,5}");
        });
});

and in app after build during startup of your application

var app = builder.Build();
await app.Services.WarmUpAsync();

or if you have in Value an object

AddRepository<User, string>(builder => {
    builder
        .WithInMemory(inMemoryBuilder => {
            inMemoryBuilder
                .PopulateWithRandomData(100, 6)
                .WithPattern(x => x.Claims!.First().Value.SomeProperty, "[a-z]{4,5}");
        });
});

and in app after build during startup of your application

var app = builder.Build();
await app.Services.WarmUpAsync();

Populate with delegation

Similar to regex pattern, you can use a delegation to populate something.

Dictionary (example)

Here you can see that all 6 elements in each 100 users are populated in Value with string "A"

.AddRepository<User, string>(builder => {
    builder
        .WithInMemory(inMemoryBuilder => {
            inMemoryBuilder
                .PopulateWithRandomData(100, 6)
                .WithPattern(x => x.Claims!.First().Value, () => "A");
        });
});

and in app after build during startup of your application

var app = builder.Build();
await app.Services.WarmUpAsync();

Populate with Implementation

If you have an interface or abstraction in your model, you can specify an implementation type for population. You have two different methods, with typeof

.AddRepository<PopulationTest, string>(builder => {
    builder
        .WithInMemory(inMemoryBuilder => {
            inMemoryBuilder
                .PopulateWithRandomData(100, 2)
                .WithImplementation(x => x.I, typeof(MyInnerInterfaceImplementation));
        });
});

or generics

.AddRepository<PopulationTest, string>(builder => {
    builder
        .WithInMemory(inMemoryBuilder => {
            inMemoryBuilder
                .PopulateWithRandomData(100)
                .WithImplementation<IInnerInterface, MyInnerInterfaceImplementation>(x => x.I!);
        });
});

In Memory, simulate real implementation

If you want to test with possible exceptions (for your reliability tests) and waiting time (for your load tests) you may do it with this library and in memory behavior settings.

Add random exceptions

You can set different custom exceptions and different percentage for each operation: Delete, Get, Insert, Update, Query. In the code below I'm adding three exceptions with a percentage of throwing them, they are the same for each operation. I have a 0.45% for normal Exception, 0.1% for "Big Exception" and 0.548% for "Great Exception"

.AddRepository<Car, string>(settings =>
{
    settings.WithInMemory(builder =>
    {
        var customExceptions = new List<ExceptionOdds>
        {
            new ExceptionOdds()
            {
                Exception = new Exception("Normal Exception"),
                Percentage = 10.352
            },
            new ExceptionOdds()
            {
                Exception = new Exception("Big Exception"),
                Percentage = 49.1
            },
            new ExceptionOdds()
            {
                Exception = new Exception("Great Exception"),
                Percentage = 40.548
            }
        };
        builder.Settings.AddForRepositoryPattern(new MethodBehaviorSetting
        {
            ExceptionOdds = customExceptions
        });
    });
});

Add random waiting time

You can set different range in milliseconds for each operation to simulate the await of an external integration. In the code below I'm adding a same custom range for all Repository interfaces between 1000ms and 2000ms.

.AddRepository<User, string>(builder =>
{
    builder.WithInMemory(inMemoryBuilder =>
    {
        var customRange = new Range(1000, 2000);
        inMemoryBuilder.Settings.AddForRepositoryPattern(new MethodBehaviorSetting
        {
            MillisecondsOfWait = customRange
        });
    });
});
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
10.0.1 60,553 11/12/2025
9.1.3 264 9/2/2025
9.1.2 764,451 5/29/2025
9.1.1 97,823 5/2/2025
9.0.32 186,732 4/15/2025
9.0.31 5,850 4/2/2025
9.0.30 88,828 3/26/2025
9.0.29 9,021 3/18/2025
9.0.28 237 3/17/2025
9.0.27 261 3/16/2025
9.0.26 242 3/13/2025
9.0.25 52,122 3/9/2025
9.0.21 292 3/6/2025
9.0.20 19,546 3/6/2025
9.0.19 290 3/6/2025
9.0.18 289 3/4/2025
9.0.17 176 3/1/2025
9.0.16 180 3/1/2025
9.0.15 75,509 2/22/2025
9.0.14 22,570 2/18/2025
9.0.13 200 2/9/2025
9.0.12 217,730 1/13/2025
9.0.11 24,043 1/9/2025
9.0.10 172 1/9/2025
9.0.9 4,062 1/7/2025
9.0.8 12,556 1/6/2025
9.0.7 183 1/6/2025
9.0.4 92,304 12/23/2024
9.0.3 201 12/22/2024
9.0.2 10,745 12/21/2024
9.0.1 1,243 12/21/2024
9.0.0 173,050 11/16/2024
9.0.0-rc.1 141 10/18/2024
6.2.0 219,114 10/9/2024
6.1.1 212 10/9/2024
6.1.0 47,976 9/29/2024
6.0.24 223 9/11/2024
6.0.23 238 7/18/2024
6.0.21 234 6/18/2024
6.0.20 210 6/16/2024
6.0.19 699 6/14/2024
6.0.18 194 6/14/2024
6.0.17 195 6/14/2024
6.0.16 200 6/10/2024
6.0.15 212 6/9/2024
6.0.14 226 5/24/2024
6.0.13 215 5/23/2024
6.0.12 270 5/23/2024
6.0.11 226 5/20/2024
6.0.9 214 5/20/2024
6.0.7 207 5/18/2024
6.0.6 198 5/10/2024
6.0.5 206 5/10/2024
6.0.4 227 4/3/2024
6.0.3 259 3/25/2024
6.0.2 214 3/11/2024
6.0.0 346 11/21/2023
6.0.0-rc.6 154 10/25/2023
6.0.0-rc.5 159 10/25/2023
6.0.0-rc.4 133 10/23/2023
6.0.0-rc.3 117 10/19/2023
6.0.0-rc.2 123 10/18/2023
6.0.0-rc.1 118 10/16/2023
5.0.20 264 9/25/2023
5.0.19 290 9/10/2023
5.0.18 270 9/6/2023
5.0.17 230 9/6/2023
5.0.16 219 9/5/2023
5.0.15 236 9/5/2023
5.0.14 256 9/5/2023
5.0.13 238 9/1/2023
5.0.12 216 8/31/2023
5.0.11 224 8/30/2023
5.0.10 232 8/29/2023
5.0.9 234 8/24/2023
5.0.8 227 8/24/2023
5.0.7 244 8/23/2023
5.0.6 233 8/21/2023
5.0.5 233 8/21/2023
5.0.4 284 8/16/2023
5.0.3 262 8/2/2023
5.0.2 259 8/2/2023
5.0.1 258 8/1/2023
5.0.0 275 7/31/2023
4.1.26 279 7/20/2023
4.1.25 284 7/16/2023
4.1.24 323 6/13/2023
4.1.23 290 6/13/2023
4.1.22 278 5/30/2023
4.1.21 312 5/20/2023
4.1.20 315,299 4/19/2023
4.1.19 95,174 3/20/2023
4.1.18 417 3/20/2023
4.1.17 358 3/16/2023
4.1.16 391 3/16/2023
4.1.15 397 3/15/2023
4.1.14 951 3/9/2023
4.1.13 420 3/7/2023
4.1.12 425 2/10/2023
4.1.11 502 1/26/2023
4.1.10 491 1/22/2023
4.1.9 474 1/20/2023
4.1.8 460 1/18/2023
4.1.7 638 1/18/2023
4.1.6 471 1/17/2023
4.1.1 514 1/4/2023
4.1.0 536 1/1/2023
3.1.5 455 12/21/2022
3.1.3 474 12/12/2022
3.1.2 481 12/7/2022
3.1.1 462 12/7/2022
3.1.0 528 12/2/2022
3.0.29 521 12/1/2022
3.0.28 470 12/1/2022
3.0.27 525 11/23/2022
3.0.25 485 11/23/2022
3.0.24 520 11/18/2022
3.0.23 489 11/18/2022
3.0.22 509 11/15/2022
3.0.21 502 11/14/2022
3.0.20 549 11/13/2022
3.0.19 540 11/2/2022
3.0.18 539 11/2/2022
3.0.17 584 10/29/2022
3.0.16 539 10/29/2022
3.0.15 563 10/29/2022
3.0.14 594 10/24/2022
3.0.13 565 10/24/2022
3.0.12 572 10/17/2022
3.0.11 607 10/10/2022
3.0.10 581 10/6/2022
3.0.9 578 10/6/2022
3.0.8 587 10/6/2022
3.0.7 603 10/6/2022
3.0.6 558 10/5/2022
3.0.5 586 10/5/2022
3.0.4 600 10/5/2022
3.0.3 586 10/3/2022
3.0.2 569 9/30/2022
3.0.1 580 9/29/2022
2.0.17 618 9/29/2022
2.0.16 625 9/27/2022
2.0.15 657 9/27/2022
2.0.14 623 9/26/2022
2.0.13 633 9/26/2022
2.0.12 634 9/26/2022
2.0.11 624 9/25/2022
2.0.10 655 9/25/2022
2.0.9 633 9/22/2022
2.0.8 627 9/22/2022
2.0.6 618 9/20/2022
2.0.5 623 9/20/2022
2.0.4 619 9/20/2022
2.0.2 647 9/20/2022
2.0.1 698 9/13/2022
2.0.0 646 8/19/2022
1.1.24 643 7/30/2022
1.1.23 617 7/29/2022
1.1.22 639 7/29/2022
1.1.21 940 7/29/2022
1.1.20 650 7/29/2022
1.1.19 720 7/27/2022
1.1.17 628 7/27/2022
1.1.16 662 7/26/2022
1.1.15 641 7/25/2022
1.1.14 638 7/25/2022
1.1.13 653 7/22/2022
1.1.12 646 7/19/2022
1.1.11 692 7/19/2022
1.1.10 644 7/19/2022
1.1.9 672 7/19/2022
1.1.8 676 7/18/2022
1.1.7 645 7/18/2022
1.1.6 648 7/18/2022
1.1.5 655 7/17/2022
1.1.4 652 7/17/2022
1.1.3 660 7/17/2022
1.1.2 667 7/17/2022
1.1.0 673 7/17/2022
1.0.2 656 7/15/2022
1.0.1 640 7/15/2022
1.0.0 662 7/8/2022
0.10.7 660 7/7/2022
0.10.2 709 7/2/2022
0.10.1 642 7/1/2022
0.10.0 666 7/1/2022
0.9.12 658 6/29/2022
0.9.11 714 6/20/2022
0.9.10 657 6/20/2022
0.9.9 650 6/11/2022
0.9.7 703 6/9/2022
0.9.6 675 6/5/2022
0.9.5 656 6/3/2022
0.9.4 658 6/3/2022
0.9.3 616 6/3/2022
0.9.2 632 5/31/2022
0.9.1 644 5/31/2022
0.9.0 655 5/31/2022