GunStoreIMS.Models 0.1.14

dotnet add package GunStoreIMS.Models --version 0.1.14
                    
NuGet\Install-Package GunStoreIMS.Models -Version 0.1.14
                    
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="GunStoreIMS.Models" Version="0.1.14" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="GunStoreIMS.Models" Version="0.1.14" />
                    
Directory.Packages.props
<PackageReference Include="GunStoreIMS.Models" />
                    
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 GunStoreIMS.Models --version 0.1.14
                    
#r "nuget: GunStoreIMS.Models, 0.1.14"
                    
#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 GunStoreIMS.Models@0.1.14
                    
#: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=GunStoreIMS.Models&version=0.1.14
                    
Install as a Cake Addin
#tool nuget:?package=GunStoreIMS.Models&version=0.1.14
                    
Install as a Cake Tool

GunStoreIMS C# SDK

Build & Test CodeQL Publish NuGet Version NuGet Downloads Documentation License: MIT

Production-ready C# models generated from the GunStoreIMS schema registry.

🚀 Enterprise-Grade CI/CD: Built on self-hosted infrastructure with deterministic builds, security scanning, and automated publishing. See Enterprise Architecture for details.

Features

✅ Immutable versioning – Pinned to registry version v0.1.2 ✅ SHA-256 integrity checks – Every schema fetch is cryptographically verified ✅ System.Text.Json – Native JSON serialization support ✅ Nullable reference types – Full C# 8+ nullability annotations ✅ Source Link – Debug into the source via NuGet symbols ✅ Deterministic builds – Reproducible packages with embedded sources ✅ Security scanning – Weekly CodeQL analysis

Installation

dotnet add package GunStoreIMS.Models

Or via NuGet Package Manager:

Install-Package GunStoreIMS.Models

Usage

Basic Example

using System.Text.Json;
using GunStoreIMS.Models.Inventory.SerializedInventoryItem; // File-specific namespace

// Create an instance
var item = new Anonymous
{
    // Set properties as defined in schema
    // Note: Class name is "Anonymous" - generated from schema
};

// Serialize to JSON
var json = JsonSerializer.Serialize(item, new JsonSerializerOptions
{
    WriteIndented = true
});

// Deserialize from JSON
var roundTrip = JsonSerializer.Deserialize<Anonymous>(json);

Getting Started: Understanding Namespaces

This SDK uses file-specific namespaces to avoid type collisions:

// ✅ Correct: Import the specific file's namespace
using GunStoreIMS.Models.Inventory.SerializedInventoryItem;
using GunStoreIMS.Models.Compliance.Form4473;

// The class name depends on the schema's "title" field
// Common class names: Anonymous, Anonymous2, or schema-specific titles
Pro Tip: Use Global Usings

Add to your project's GlobalUsings.cs for convenience:

// GlobalUsings.cs
global using GunStoreIMS.Models.Inventory.SerializedInventoryItem;
global using GunStoreIMS.Models.Compliance.Form4473;
global using GunStoreIMS.Models.Sales.Customer;
global using GunStoreIMS.Models.Party.Party;
// ... add your most-used namespaces

Complete Example: Inventory Management

using System.Text.Json;
using GunStoreIMS.Models.Inventory.Firearm;

// Create a firearm record
var firearm = new Anonymous
{
    // Populate required fields from schema
};

// Serialize with System.Text.Json
var options = new JsonSerializerOptions
{
    WriteIndented = true,
    PropertyNameCaseInsensitive = true
};

var json = JsonSerializer.Serialize(firearm, options);
Console.WriteLine(json);

// Deserialize
var deserialized = JsonSerializer.Deserialize<Anonymous>(json, options);

Working with Enums

using GunStoreIMS.Models.Compliance.Form4473Status;

// Enums are strongly typed
var status = Form4473Status.Pending;

// JSON serialization handles enums automatically
var json = JsonSerializer.Serialize(status);
// Output: "Pending" (string in JSON)

Extension Data (Additional Properties)

Many models support additional properties via JsonExtensionData:

using System.Collections.Generic;
using System.Text.Json;
using GunStoreIMS.Models.Common.Address;

var jsonWithExtras = """
{
  "street": "123 Main St",
  "customField": "custom value"
}
""";

var address = JsonSerializer.Deserialize<Anonymous>(jsonWithExtras);

// Access extension data if the model supports it
// Check the generated code for IDictionary<string, object> properties

Discovering Available Types

Use reflection to explore generated types:

using System.Reflection;

var assembly = Assembly.Load("GunStoreIMS.Models");
var inventoryTypes = assembly.GetTypes()
    .Where(t => t.Namespace?.StartsWith("GunStoreIMS.Models.Inventory") == true)
    .ToList();

foreach (var type in inventoryTypes)
{
    Console.WriteLine($"{type.Namespace}.{type.Name}");
}

Schema Version

This SDK is generated from schema registry version v0.1.2.

All schemas are fetched from:

https://schemas.gunstoreims.com/v0.1.2/

Development

Prerequisites

  • .NET 8.0 SDK
  • PowerShell 7+ (Windows) or Bash (Linux/macOS)

Generate Models from Registry

# Windows (PowerShell)
cd src/GunStoreIMS.Models/CodeGen
./fetch-and-generate.ps1

# Linux/macOS (Bash)
cd src/GunStoreIMS.Models/CodeGen
chmod +x fetch-and-generate.sh
./fetch-and-generate.sh

Build & Pack

dotnet restore
dotnet build -c Release
dotnet pack -c Release -o ./artifacts

Run Tests

dotnet test -c Release

Architecture

gunstoreims-csharp-sdk/
├─ src/
│  └─ GunStoreIMS.Models/
│     ├─ GunStoreIMS.Models.csproj
│     ├─ CodeGen/                    # Code generation scripts & config
│     │  ├─ codegen.settings.json    # NJsonSchema generator settings
│     │  ├─ schema-sources.json      # List of schemas to generate
│     │  ├─ fetch-and-generate.ps1   # Windows generation script
│     │  └─ fetch-and-generate.sh    # Linux/macOS generation script
│     ├─ Generated/                  # Generated C# POCOs (committed)
│     └─ GlobalUsings.cs
├─ Directory.Build.props              # Schema version & package config
├─ Directory.Packages.props           # Central package management
└─ .github/workflows/ci.yml          # CI/CD pipeline

Schema Governance

This SDK is read-only and immutable:

  • Source of truth: gunstoreims-schemas repository
  • Version pinning: Each SDK release maps to a specific schema version (e.g., v0.1.2)
  • Integrity verification: SHA-256 checksums ensure no tampering

To update schemas:

  1. Modify schemas in the gunstoreims-schemas repository
  2. Publish new registry version (e.g., v0.1.3)
  3. Update <SchemaVersion> in Directory.Build.props
  4. Re-run code generation
  5. Publish new SDK version

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This SDK is licensed under the MIT License.

Documentation & Policies

Support


Built with ❤️ by the GunStoreIMS team

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
0.1.14 4,570 11/11/2025