Franz.Common 1.2.64

dotnet add package Franz.Common --version 1.2.64                
NuGet\Install-Package Franz.Common -Version 1.2.64                
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="Franz.Common" Version="1.2.64" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Franz.Common --version 1.2.64                
#r "nuget: Franz.Common, 1.2.64"                
#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 Franz.Common as a Cake Addin
#addin nuget:?package=Franz.Common&version=1.2.64

// Install Franz.Common as a Cake Tool
#tool nuget:?package=Franz.Common&version=1.2.64                

Franz.Common

A foundational library in the Franz Framework designed to provide core utilities, dependency injection abstractions, and common extensions for .NET applications. This library is part of the private Franz Framework ecosystem, versioned as 1.2.64, and hosted on a private Azure NuGet feed.


Features

Dependency Injection Interfaces

  • IScopedDependency: Marker interface for services with a scoped lifetime.
  • ISingletonDependency: Marker interface for services with a singleton lifetime.

Important: Any service interface must inherit from either IScopedDependency or ISingletonDependency. Services that do not implement one of these interfaces will not be registered properly in the dependency injection system.

Data Seeding

  • ISeeder: Interface for implementing database seeding logic.
    • Includes:
      • Order: Determines the execution order of seeders.
      • SeedAsync(): Defines the asynchronous method for data initialization.

Extensions

  • CollectionExtensions:
    • Includes methods for manipulating and interacting with collections:
      • AddIfNotContains
      • AddRange
      • IsNullOrEmpty
  • EnumerableExtensions:
    • Enhances LINQ functionality with methods such as ForEach.
  • HostEnvironmentExtensions:
    • Helps determine the current environment:
      • IsIntegration
      • IsValidation
      • IsPreProduction

Core Utilities

  • Company: Provides foundational business logic for managing company-related data.
  • ProductGeneration: Handles logic for generating product-related data.

Version Information

  • Current Version: 1.2.64
  • Part of the private Franz Framework suite, hosted on a private Azure NuGet feed.

Installation

Step 1: Add the Private Azure Feed

Configure your NuGet client to access the private Azure feed:

dotnet nuget add source "https://your-private-feed-url" \
  --name "AzurePrivateFeed" \
  --username "YourAzureUsername" \
  --password "YourAzurePassword" \
  --store-password-in-clear-text

Step 2: Install the Package

Use the .NET CLI to install:

dotnet add package Franz.Common --Version 1.2.64

Usage

1. Dependency Injection

Use IScopedDependency and ISingletonDependency to simplify service registrations. Ensure that your service interfaces implement one of these dependencies.

Scoped Service Example:
public interface IScopedExampleService : IScopedDependency
{
    void PerformScopedOperation();
}

public class ScopedExampleService : IScopedExampleService
{
    public void PerformScopedOperation()
    {
        Console.WriteLine("Scoped operation executed.");
    }
}

// Registration
services.AddScoped<IScopedExampleService, ScopedExampleService>();
Singleton Service Example:
public interface ISingletonExampleService : ISingletonDependency
{
    string GetConfigValue();
}

public class SingletonExampleService : ISingletonExampleService
{
    public string GetConfigValue() => "Singleton Config";
}

// Registration
services.AddSingleton<ISingletonExampleService, SingletonExampleService>();

2. Database Seeding

Implement the ISeeder interface for database initialization:

public class ExampleSeeder : ISeeder
{
    public int Order => 1;

    public async Task SeedAsync()
    {
        Console.WriteLine("Seeding database...");
        // Add your data seeding logic here
        await Task.CompletedTask;
    }
}

// Example usage
var seeders = serviceProvider.GetServices<ISeeder>()
                             .OrderBy(seeder => seeder.Order);

foreach (var seeder in seeders)
{
    await seeder.SeedAsync();
}

3. Extensions

Collection Extensions:
var list = new List<int> { 1, 2, 3 };

// Check if list is null or empty
if (!list.IsNullOrEmpty())
{
    Console.WriteLine("List contains elements.");
}

// Add an item if it doesn't exist
list.AddIfNotContains(4); // Adds 4
list.AddIfNotContains(1); // Does nothing

// Add a range of items
list.AddRange(new[] { 5, 6 });
Enumerable Extensions:
var numbers = Enumerable.Range(1, 5);

// Perform an action for each element
numbers.ForEach(x => Console.WriteLine($"Processing {x}"));
Host Environment Extensions:
if (hostEnvironment.IsIntegration())
{
    Console.WriteLine("Running in the integration environment.");
}
else if (hostEnvironment.IsValidation())
{
    Console.WriteLine("Running in the validation environment.");
}
else if (hostEnvironment.IsPreProduction())
{
    Console.WriteLine("Running in the pre-production environment.");
}

Dependencies

This library is fully self-contained and serves as a core building block for the private Franz Framework.


Development Notes

This library is part of the private Franz Framework and is not publicly available. It is distributed exclusively through a private Azure NuGet feed.

Contributing

Contributions are restricted to the Franz Framework development team. If you are authorized to contribute:

  1. Clone the repository. @ https://github.com/bestacio89/Franz.Common/
  2. Create a feature branch.
  3. Submit a pull request with a detailed explanation of your changes.

License

This library is private and governed by the Franz Framework's internal licensing terms. For licensing inquiries, please contact the framework's maintainers.


Changelog

Version 1.2.64

  • Upgrade version to .net 9

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (7)

Showing the top 5 NuGet packages that depend on Franz.Common:

Package Downloads
Franz.Common.DependencyInjection

Shared utility library for the Franz Framework.

Franz.Common.Reflection

Shared utility library for the Franz Framework.

Franz.Common.Headers

Shared utility library for the Franz Framework.

Franz.Common.Hosting

Shared utility library for the Franz Framework.

Franz.Common.Serialization

Shared utility library for the Franz Framework.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.2.64 13 1/29/2025
1.2.63 176 1/27/2025
1.2.62 186 1/8/2025