Skip to content

Library Template

This document provides an overview of the ConnectSoft Library Template for creating reusable .NET Core libraries. It is written for architects and engineers understanding how to create and structure reusable libraries that follow ConnectSoft's architectural principles.

The Library Template provides a standard structure for creating reusable libraries that can be published as NuGet packages and used across multiple projects and services.

Note

Libraries created with this template follow ConnectSoft's architectural principles and are designed for multi-tenant SaaS applications. They integrate seamlessly with Factory-generated code and can be used by both agents and human developers.

Purpose

The Library Template enables the creation of:

  • Reusable functionality - Common code that can be shared across projects
  • NuGet packages - Versioned, distributable libraries
  • Consistent patterns - Standard structure and conventions
  • Testable components - Built-in testing support
  • CI/CD ready - Pre-configured build and publish pipelines

Template Structure

A library created with this template follows this structure:

ConnectSoft.Extensions.MyLibrary/
├── src/
│   └── ConnectSoft.Extensions.MyLibrary/
│       ├── Core functionality
│       ├── Abstractions and interfaces
│       ├── Extension methods
│       └── Configuration
├── tests/
│   └── ConnectSoft.Extensions.MyLibrary.Tests/
│       ├── Unit tests
│       └── Integration tests
├── README.md
├── .csproj files
└── CI/CD pipeline

Key Features

Standard Structure

  • Core functionality - Main library code
  • Abstractions - Interfaces and contracts
  • Extension methods - Convenience extensions
  • Configuration - Options pattern support
  • Dependency injection - DI registration extensions

Testing Support

  • Unit tests - Test project included
  • Test utilities - Helpers for testing
  • Integration tests - Optional integration test support

CI/CD Integration

  • Azure DevOps pipeline - Pre-configured build and test
  • NuGet publishing - Automated package publishing
  • Versioning - Semantic versioning support

Documentation

  • README.md - Library documentation template
  • XML documentation - Code documentation support
  • Usage examples - Example code snippets

Usage Patterns

Creating a New Library

  1. Use the template - Generate library structure from template
  2. Implement functionality - Add core library code
  3. Add tests - Write unit and integration tests
  4. Configure CI/CD - Set up build and publish pipeline
  5. Publish to NuGet - Make library available to consumers

Library Design Principles

  • Single responsibility - Each library has a focused purpose
  • Dependency minimal - Keep dependencies to a minimum
  • Backward compatible - Follow semantic versioning
  • Well documented - Clear documentation and examples
  • Tested - Comprehensive test coverage

Integration with Templates

Libraries created with this template can be:

  • Referenced by microservices - Used in Factory-generated services
  • Included in templates - Added to microservice template dependencies
  • Shared across projects - Used by multiple services and applications