Chakra.Core 2.0.12

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

Install-Package Chakra.Core -Version 2.0.12
dotnet add package Chakra.Core --version 2.0.12
paket add Chakra.Core --version 2.0.12
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.

Version History

Version Downloads Last updated
2.0.12 79 10/30/2018
2.0.11 54 10/30/2018
2.0.10 170 7/17/2018
2.0.8 120 5/7/2018
2.0.7 223 12/20/2017
2.0.6 150 12/16/2017
2.0.5 121 12/7/2017
2.0.4 116 12/5/2017
2.0.3 112 12/5/2017
2.0.2 157 11/8/2017