Rystem.RepositoryFramework.Infrastructure.InMemory
6.0.0-rc.6
See the version list below for details.
dotnet add package Rystem.RepositoryFramework.Infrastructure.InMemory --version 6.0.0-rc.6
NuGet\Install-Package Rystem.RepositoryFramework.Infrastructure.InMemory -Version 6.0.0-rc.6
<PackageReference Include="Rystem.RepositoryFramework.Infrastructure.InMemory" Version="6.0.0-rc.6" />
paket add Rystem.RepositoryFramework.Infrastructure.InMemory --version 6.0.0-rc.6
#r "nuget: Rystem.RepositoryFramework.Infrastructure.InMemory, 6.0.0-rc.6"
// Install Rystem.RepositoryFramework.Infrastructure.InMemory as a Cake Addin #addin nuget:?package=Rystem.RepositoryFramework.Infrastructure.InMemory&version=6.0.0-rc.6&prerelease // Install Rystem.RepositoryFramework.Infrastructure.InMemory as a Cake Tool #tool nuget:?package=Rystem.RepositoryFramework.Infrastructure.InMemory&version=6.0.0-rc.6&prerelease
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 | Versions 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. |
-
net8.0
- Fare (>= 2.2.1)
- Rystem.RepositoryFramework.Abstractions (>= 6.0.0-rc.6)
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 |
---|---|---|
9.0.0 | 34,977 | 11/16/2024 |
9.0.0-rc.1 | 73 | 10/18/2024 |
6.2.0 | 219,006 | 10/9/2024 |
6.1.1 | 100 | 10/9/2024 |
6.1.0 | 47,882 | 9/29/2024 |
6.0.24 | 116 | 9/11/2024 |
6.0.23 | 103 | 7/18/2024 |
6.0.21 | 105 | 6/18/2024 |
6.0.20 | 102 | 6/16/2024 |
6.0.19 | 345 | 6/14/2024 |
6.0.18 | 101 | 6/14/2024 |
6.0.17 | 97 | 6/14/2024 |
6.0.16 | 97 | 6/10/2024 |
6.0.15 | 108 | 6/9/2024 |
6.0.14 | 123 | 5/24/2024 |
6.0.13 | 111 | 5/23/2024 |
6.0.12 | 116 | 5/23/2024 |
6.0.11 | 116 | 5/20/2024 |
6.0.9 | 118 | 5/20/2024 |
6.0.7 | 107 | 5/18/2024 |
6.0.6 | 91 | 5/10/2024 |
6.0.5 | 95 | 5/10/2024 |
6.0.4 | 125 | 4/3/2024 |
6.0.3 | 118 | 3/25/2024 |
6.0.2 | 110 | 3/11/2024 |
6.0.0 | 279 | 11/21/2023 |
6.0.0-rc.6 | 104 | 10/25/2023 |
6.0.0-rc.5 | 85 | 10/25/2023 |
6.0.0-rc.4 | 71 | 10/23/2023 |
6.0.0-rc.3 | 70 | 10/19/2023 |
6.0.0-rc.2 | 76 | 10/18/2023 |
6.0.0-rc.1 | 70 | 10/16/2023 |
5.0.20 | 188 | 9/25/2023 |
5.0.19 | 224 | 9/10/2023 |
5.0.18 | 180 | 9/6/2023 |
5.0.17 | 144 | 9/6/2023 |
5.0.16 | 144 | 9/5/2023 |
5.0.15 | 149 | 9/5/2023 |
5.0.14 | 161 | 9/5/2023 |
5.0.13 | 151 | 9/1/2023 |
5.0.12 | 145 | 8/31/2023 |
5.0.11 | 133 | 8/30/2023 |
5.0.10 | 149 | 8/29/2023 |
5.0.9 | 167 | 8/24/2023 |
5.0.8 | 152 | 8/24/2023 |
5.0.7 | 159 | 8/23/2023 |
5.0.6 | 160 | 8/21/2023 |
5.0.5 | 149 | 8/21/2023 |
5.0.4 | 178 | 8/16/2023 |
5.0.3 | 174 | 8/2/2023 |
5.0.2 | 169 | 8/2/2023 |
5.0.1 | 160 | 8/1/2023 |
5.0.0 | 181 | 7/31/2023 |
4.1.26 | 182 | 7/20/2023 |
4.1.25 | 199 | 7/16/2023 |
4.1.24 | 218 | 6/13/2023 |
4.1.23 | 181 | 6/13/2023 |
4.1.22 | 171 | 5/30/2023 |
4.1.21 | 203 | 5/20/2023 |
4.1.20 | 315,188 | 4/19/2023 |
4.1.19 | 95,067 | 3/20/2023 |
4.1.18 | 267 | 3/20/2023 |
4.1.17 | 254 | 3/16/2023 |
4.1.16 | 271 | 3/16/2023 |
4.1.15 | 266 | 3/15/2023 |
4.1.14 | 848 | 3/9/2023 |
4.1.13 | 275 | 3/7/2023 |
4.1.12 | 309 | 2/10/2023 |
4.1.11 | 365 | 1/26/2023 |
4.1.10 | 370 | 1/22/2023 |
4.1.9 | 346 | 1/20/2023 |
4.1.8 | 346 | 1/18/2023 |
4.1.7 | 517 | 1/18/2023 |
4.1.6 | 327 | 1/17/2023 |
4.1.1 | 372 | 1/4/2023 |
4.1.0 | 411 | 1/1/2023 |
3.1.5 | 358 | 12/21/2022 |
3.1.3 | 369 | 12/12/2022 |
3.1.2 | 344 | 12/7/2022 |
3.1.1 | 349 | 12/7/2022 |
3.1.0 | 399 | 12/2/2022 |
3.0.29 | 397 | 12/1/2022 |
3.0.28 | 356 | 12/1/2022 |
3.0.27 | 405 | 11/23/2022 |
3.0.25 | 362 | 11/23/2022 |
3.0.24 | 393 | 11/18/2022 |
3.0.23 | 359 | 11/18/2022 |
3.0.22 | 385 | 11/15/2022 |
3.0.21 | 389 | 11/14/2022 |
3.0.20 | 420 | 11/13/2022 |
3.0.19 | 420 | 11/2/2022 |
3.0.18 | 413 | 11/2/2022 |
3.0.17 | 458 | 10/29/2022 |
3.0.16 | 421 | 10/29/2022 |
3.0.15 | 433 | 10/29/2022 |
3.0.14 | 451 | 10/24/2022 |
3.0.13 | 435 | 10/24/2022 |
3.0.12 | 448 | 10/17/2022 |
3.0.11 | 477 | 10/10/2022 |
3.0.10 | 450 | 10/6/2022 |
3.0.9 | 448 | 10/6/2022 |
3.0.8 | 450 | 10/6/2022 |
3.0.7 | 471 | 10/6/2022 |
3.0.6 | 449 | 10/5/2022 |
3.0.5 | 460 | 10/5/2022 |
3.0.4 | 482 | 10/5/2022 |
3.0.3 | 458 | 10/3/2022 |
3.0.2 | 444 | 9/30/2022 |
3.0.1 | 452 | 9/29/2022 |
2.0.17 | 462 | 9/29/2022 |
2.0.16 | 488 | 9/27/2022 |
2.0.15 | 504 | 9/27/2022 |
2.0.14 | 503 | 9/26/2022 |
2.0.13 | 510 | 9/26/2022 |
2.0.12 | 503 | 9/26/2022 |
2.0.11 | 489 | 9/25/2022 |
2.0.10 | 521 | 9/25/2022 |
2.0.9 | 498 | 9/22/2022 |
2.0.8 | 482 | 9/22/2022 |
2.0.6 | 486 | 9/20/2022 |
2.0.5 | 477 | 9/20/2022 |
2.0.4 | 495 | 9/20/2022 |
2.0.2 | 518 | 9/20/2022 |
2.0.1 | 565 | 9/13/2022 |
2.0.0 | 498 | 8/19/2022 |
1.1.24 | 511 | 7/30/2022 |
1.1.23 | 494 | 7/29/2022 |
1.1.22 | 495 | 7/29/2022 |
1.1.21 | 801 | 7/29/2022 |
1.1.20 | 514 | 7/29/2022 |
1.1.19 | 570 | 7/27/2022 |
1.1.17 | 502 | 7/27/2022 |
1.1.16 | 518 | 7/26/2022 |
1.1.15 | 502 | 7/25/2022 |
1.1.14 | 515 | 7/25/2022 |
1.1.13 | 514 | 7/22/2022 |
1.1.12 | 520 | 7/19/2022 |
1.1.11 | 556 | 7/19/2022 |
1.1.10 | 504 | 7/19/2022 |
1.1.9 | 539 | 7/19/2022 |
1.1.8 | 509 | 7/18/2022 |
1.1.7 | 518 | 7/18/2022 |
1.1.6 | 514 | 7/18/2022 |
1.1.5 | 516 | 7/17/2022 |
1.1.4 | 520 | 7/17/2022 |
1.1.3 | 532 | 7/17/2022 |
1.1.2 | 532 | 7/17/2022 |
1.1.0 | 533 | 7/17/2022 |
1.0.2 | 521 | 7/15/2022 |
1.0.1 | 502 | 7/15/2022 |
1.0.0 | 533 | 7/8/2022 |
0.10.7 | 518 | 7/7/2022 |
0.10.2 | 581 | 7/2/2022 |
0.10.1 | 504 | 7/1/2022 |
0.10.0 | 507 | 7/1/2022 |
0.9.12 | 520 | 6/29/2022 |
0.9.11 | 565 | 6/20/2022 |
0.9.10 | 519 | 6/20/2022 |
0.9.9 | 511 | 6/11/2022 |
0.9.7 | 558 | 6/9/2022 |
0.9.6 | 531 | 6/5/2022 |
0.9.5 | 520 | 6/3/2022 |
0.9.4 | 510 | 6/3/2022 |
0.9.3 | 486 | 6/3/2022 |
0.9.2 | 489 | 5/31/2022 |
0.9.1 | 495 | 5/31/2022 |
0.9.0 | 510 | 5/31/2022 |