Chakra.Core 2.0.13

Framework and guidelines for build .NET enterprise applications using .NET Standard

Install-Package Chakra.Core -Version 2.0.13
dotnet add package Chakra.Core --version 2.0.13
<PackageReference Include="Chakra.Core" Version="2.0.13" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Chakra.Core --version 2.0.13
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Chakra.Core

Framework and guidelines for build .NET 4.x and .NET Core based enterprise applications.

  1. Given a defined set of entities and model for your application workflow...
public class Product: IEntity
{
    public int? Id { get; set; }
    public string Code { get; set; }
    public string Name { get; set; }
    public string Description { get; set; }
}
  1. Define a repository interface for retrieve your domain entities
public interface IProductRepository: IRepository<Product>
{
    IList<Product> FetchAvailableProductsInPeriod(DateTime from, DateTime to);
}
  1. Define one or more fake scenarios with a common interface for test (ad unit test) your application layers
public class IApplicationScenario: IScenario
{
    IList<Product> Product{ get; set; }
}

public class SimpleScenario: IApplicationScenario
{
    public IList<Product> Product{ get; set; }

    public void InitializeEntities()
    {
        Products.Add(new Product
        {
            Id = Product.Count + 1, 
            Code = "ABC", 
            Name = "Product ABC", 
            Description = "Non important..."
        });
    }
}
  1. Implement a concrete class for a storage provider (ex: fake provider)
[Repository]
public class MockupProductRepository: MockupRepositoryBase<Product, IApplicationScenario>, IProductRepository
{
    public MockupProductRepository(IDataSession dataSession) 
        : base(dataSession, scenario => scenario.Products) { }

    public IList<Product> FetchAvailableProductsInPeriod(DateTime from, DateTime to) 
    {
        //TODO...Insert here the method implementation
		//ex. => Scenario.Products.Where(p => p...
    }
}
  1. Register default data session for application (ex. fake data provider, specifying default scenario)
ScenarioFactory.Initialize(new SimpleScenario());
SessionFactory.RegisterDefaultSession<MockupDataSession>();
  1. Open session on storage (ex. database) using default configured provider, resolve repository interface
    using registered storage provider and obtain concrete repository implementation
using (IDataSession dataSession = SessionFactory.OpenSession())
{
    var productRepository = dataSession.ResolveRepository<IProductRepository>();

    var entities = productRepository.FetchAvailableProductsInPeriod(
        new DateTime(2013, 8, 1), DateTime.Now);
}

You have the opportunity to switch a provider (ex. from fake to Entity Framework, from NHibernate
to MongoDb) changing a single line of code on your application that can be really database agnostic
and every single part can be tested in its own isolated context.

Chakra.Core

Framework and guidelines for build .NET 4.x and .NET Core based enterprise applications.

  1. Given a defined set of entities and model for your application workflow...
public class Product: IEntity
{
    public int? Id { get; set; }
    public string Code { get; set; }
    public string Name { get; set; }
    public string Description { get; set; }
}
  1. Define a repository interface for retrieve your domain entities
public interface IProductRepository: IRepository<Product>
{
    IList<Product> FetchAvailableProductsInPeriod(DateTime from, DateTime to);
}
  1. Define one or more fake scenarios with a common interface for test (ad unit test) your application layers
public class IApplicationScenario: IScenario
{
    IList<Product> Product{ get; set; }
}

public class SimpleScenario: IApplicationScenario
{
    public IList<Product> Product{ get; set; }

    public void InitializeEntities()
    {
        Products.Add(new Product
        {
            Id = Product.Count + 1, 
            Code = "ABC", 
            Name = "Product ABC", 
            Description = "Non important..."
        });
    }
}
  1. Implement a concrete class for a storage provider (ex: fake provider)
[Repository]
public class MockupProductRepository: MockupRepositoryBase<Product, IApplicationScenario>, IProductRepository
{
    public MockupProductRepository(IDataSession dataSession) 
        : base(dataSession, scenario => scenario.Products) { }

    public IList<Product> FetchAvailableProductsInPeriod(DateTime from, DateTime to) 
    {
        //TODO...Insert here the method implementation
		//ex. => Scenario.Products.Where(p => p...
    }
}
  1. Register default data session for application (ex. fake data provider, specifying default scenario)
ScenarioFactory.Initialize(new SimpleScenario());
SessionFactory.RegisterDefaultSession<MockupDataSession>();
  1. Open session on storage (ex. database) using default configured provider, resolve repository interface
    using registered storage provider and obtain concrete repository implementation
using (IDataSession dataSession = SessionFactory.OpenSession())
{
    var productRepository = dataSession.ResolveRepository<IProductRepository>();

    var entities = productRepository.FetchAvailableProductsInPeriod(
        new DateTime(2013, 8, 1), DateTime.Now);
}

You have the opportunity to switch a provider (ex. from fake to Entity Framework, from NHibernate
to MongoDb) changing a single line of code on your application that can be really database agnostic
and every single part can be tested in its own isolated context.

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
2.0.13 1,660 12/11/2018
2.0.12 757 10/30/2018
2.0.11 470 10/30/2018
2.0.10 354 7/17/2018
2.0.8 275 5/7/2018
2.0.7 413 12/20/2017
2.0.6 321 12/16/2017
2.0.5 286 12/7/2017
2.0.4 274 12/5/2017
2.0.3 246 12/5/2017
2.0.2 321 11/8/2017