Welcome to BeyondNet.Factory! A .NET library aimed at improving the factory and abstract factory patterns by introducing configuration-driven behavior.
# Core factory library
dotnet add package BeyondNetCode.Shell.Factory
# Dependency Injection installer
dotnet add package BeyondNetCode.Shell.Factory.Installer| Package | Description | NuGet |
|---|---|---|
BeyondNetCode.Shell.Factory |
Core factory patterns with fluent API | link |
BeyondNetCode.Shell.Factory.Installer |
Microsoft.Extensions.DependencyInjection extensions | link |
- Configuration-Driven Factory: Create factories with setup records for cleaner instantiation
- Fluent API: Chain configuration with an expressive builder interface
- Interceptor Support: Add custom logic before/after object creation
- DI Integration: Seamless integration with Microsoft.Extensions.DependencyInjection
- Generic Support: Work with generic types for better type safety
- Extensible: Easily add custom setup sources and interceptors
public interface IDoSomething
{
string DoIt(string name);
}
public class DoSomething : IDoSomething
{
public string DoIt(string name) => $"Hello, {name}!";
}// Using fluent API
var factory = new FactorySetupCreateBuilder<IFactory>()
.Create<DoSomething>()
.When<Criteria>(c => c.Age > 18)
.Build();
var service = factory.Create<DoSomething>();
var result = service.DoIt("World"); // "Hello, World!"services.AddFactory(factory =>
{
factory.Create<DoSomething>()
.When<Criteria>(c => c.Age > 18)
.Create<DoSomethingLessThan18>()
.When<Criteria>(c => c.Age <= 18);
});For detailed documentation, see the language-specific README files:
If you were using Ums.Shell.Factory, update your NuGet references:
# Before (Ums.Shell.Factory)
dotnet add package Ums.Shell.Factory
# After (BeyondNetCode.Shell.Factory)
dotnet add package BeyondNetCode.Shell.FactoryUpdate namespaces in your code:
// Before
using Ums.Shell.Factory;
// After
using BeyondNetCode.Shell.Factory;See CONTRIBUTING.md for GitFlow workflow, commit conventions, and coding standards.
See VERSIONING.md for SemVer strategy and release process.
Licensed under the MIT License. See LICENSE for details.
See DISCLAIMER.md for original code authorship attribution.