CosmicWorks.Generator 2.1.0

dotnet add package CosmicWorks.Generator --version 2.1.0
NuGet\Install-Package CosmicWorks.Generator -Version 2.1.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.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CosmicWorks.Generator --version 2.1.0
#r "nuget: CosmicWorks.Generator, 2.1.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.1.0

// Install CosmicWorks.Generator as a Cake Tool
#tool nuget:?package=CosmicWorks.Generator&version=2.1.0

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 CosmicWorks.Data;
using CosmicWorks.Generator;
using CosmicWorks.Generator.DataSource;

// Seed "employees" database
await new EmployeesCosmosDataGenerator(
    cosmosContext: new CosmosContext(),
    dataSource: new EmployeesDataSource()
).GenerateAsync(
    connectionString: "AccountEndpoint=https://localhost:8081/;AccountKey=C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==", 
    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(
    connectionString: "AccountEndpoint=https://localhost:8081/;AccountKey=C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==", 
    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
}
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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.

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
2.1.0 97 4/9/2024
2.0.3 257 8/30/2023