CosmicWorks.Generator 3.0.0-preview.1

This is a prerelease version of CosmicWorks.Generator.
dotnet add package CosmicWorks.Generator --version 3.0.0-preview.1
                    
NuGet\Install-Package CosmicWorks.Generator -Version 3.0.0-preview.1
                    
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="3.0.0-preview.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CosmicWorks.Generator" Version="3.0.0-preview.1" />
                    
Directory.Packages.props
<PackageReference Include="CosmicWorks.Generator" />
                    
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 CosmicWorks.Generator --version 3.0.0-preview.1
                    
#r "nuget: CosmicWorks.Generator, 3.0.0-preview.1"
                    
#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.
#addin nuget:?package=CosmicWorks.Generator&version=3.0.0-preview.1&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=CosmicWorks.Generator&version=3.0.0-preview.1&prerelease
                    
Install as a Cake Tool

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.Services;
using Microsoft.Samples.Cosmos.NoSQL.CosmicWorks.Models;

ConnectionOptions options = new()
{
    Type = ConnectionType.MicrosoftEntra,
    Credential = "<azure-cosmos-db-nosql-account-endpoint>"
};

{
    // Seed "products" database
    CosmosDataGenerator<Product> generator = new(
        new ProductsDataSource(),
        new CosmosDataService<Product>(
            new CosmosClientService()
        )
    );

    await generator.GenerateAsync(
        options: options,
        databaseName: "cosmicworks",
        containerName: "products",
        count: 1000,
        disableHierarchicalPartitionKeys: false,
        onItemCreate: (product) => Console.WriteLine($"[NEW PRODUCT]\t{product}")
    );
}

{
    // Seed "employees" database
    CosmosDataGenerator<Product> generator = new(
        new ProductsDataSource(),
        new CosmosDataService<Product>(
            new CosmosClientService()
        )
    );

    await generator.GenerateAsync(
        options: options,
        databaseName: "cosmicworks",
        containerName: "employees",
        count: 200,
        disableHierarchicalPartitionKeys: false,
        onItemCreate: (employee) => Console.WriteLine($"[NEW EMPLOYEE]\t{employee}")
    );
}

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": "Accessories",
  "subCategory": "Lights",
  "sku": "LT-T990",
  "tags": [
    "Accessories",
    "Lights"
  ],
  "price": 918.85,
  "quantity": 100,
  "clearance": false
}
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
3.0.0-preview.1 116 5/29/2025
2.3.1 117 11/21/2024
2.3.0 103 11/21/2024
2.2.0 103 10/24/2024
2.1.0 145 4/9/2024
2.0.3 312 8/30/2023