CosmicWorks.Generator
2.3.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package CosmicWorks.Generator --version 2.3.0
NuGet\Install-Package CosmicWorks.Generator -Version 2.3.0
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="CosmicWorks.Generator" Version="2.3.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CosmicWorks.Generator --version 2.3.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: CosmicWorks.Generator, 2.3.0"
#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.
// Install CosmicWorks.Generator as a Cake Addin #addin nuget:?package=CosmicWorks.Generator&version=2.3.0 // Install CosmicWorks.Generator as a Cake Tool #tool nuget:?package=CosmicWorks.Generator&version=2.3.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
CosmicWorks.Generator
data seeding library
CosmicWorks is an open source set of tools and libraries to generate data quickly for your proof of concept or sample applications.
Overview
Populates an Azure Cosmos DB for NoSQL container with fictiuous data generated using CosmicWorks.Data
.
💡 The CosmicWorks sample data is partially derived from AdventureWorksLT.
Usage
using Microsoft.Samples.Cosmos.NoSQL.CosmicWorks.Data;
using Microsoft.Samples.Cosmos.NoSQL.CosmicWorks.Generator;
using Microsoft.Samples.Cosmos.NoSQL.CosmicWorks.Generator.DataSource;
using Microsoft.Samples.Cosmos.NoSQL.CosmicWorks.Generator.BuilderFactory;
CosmosClientBuilderFactoryOptions options = new()
{
UseEmulator = true,
UseRoleBasedAccessControl = false,
Endpoint = null,
ConnectionString = null
};
// Seed "employees" database
await new EmployeesCosmosDataGenerator(
cosmosContext: new CosmosContext(),
dataSource: new EmployeesDataSource()
).GenerateAsync(
factoryOptions: options,
databaseName: "cosmicworks",
containerName: "employees",
count: 200,
disableHierarchicalPartitionKeys: false
onItemCreate: (result) => Console.WriteLine($"[NEW PRODUCT]\t{result}")
);
// Seed "products" database
await new ProductsCosmosDataGenerator(
cosmosContext: new CosmosContext(),
dataSource: new ProductsDataSource()
).GenerateAsync(
factoryOptions: options,
databaseName: "cosmicworks",
containerName: "products",
count: 1000,
disableHierarchicalPartitionKeys: false
onItemCreate: (result) => Console.WriteLine($"[NEW EMPLOYEE]\t{result}")
);
Data generated
Description | |
---|---|
Employees | Creates a container with fictiuous employee items and hierarchical partitoining based on /company , /department , and then /territory . |
Products | Creates a container with fictiuous product items and hierarchical partitoining based on /category.name and /category.subCategory.name . |
Sample data
Here's samples of the JSON data created using this tool with system-properties omitted:
Employees
{
"name": {
"first": "Karolina",
"last": "Rocha"
},
"addresses": [
{
"name": "Headquarters",
"street": "1234 Oak Street",
"city": "Redmond",
"state": "WA",
"zipCode": "23052",
"type": "work"
}
],
"company": "Adventure Works",
"department": "Marketing",
"emailAddress": "karolina@adventure-works.com",
"phoneNumber": "425-555-0164",
"territory": "Brazil",
"type": "employee"
}
Products
{
"name": "Taillights - Battery-Powered",
"description": "Affordable light for safe night riding - uses 3 AAA batteries",
"category": {
"name": "Accessories",
"subCategory": {
"name": "Lights"
}
},
"sku": "LT-T990",
"tags": [
"Accessories",
"Lights"
],
"price": 918.85
}
Related
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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- Azure.Identity (>= 1.13.1)
- CosmicWorks.Data (>= 2.3.0)
- CosmicWorks.Models (>= 2.3.0)
- Microsoft.Azure.Cosmos (>= 3.44.1)
- Newtonsoft.Json (>= 13.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.