Git Product home page Git Product logo

framework's Introduction

Framework

This repository contains base framework libraries which are used as mscorlib extensions. WIKI

Appveyor

Build status

framework's People

Contributors

maraf avatar

Stargazers

duong.nb avatar  avatar David Terracino avatar 小洋粉 avatar paul van bladel avatar Ivan Ivanov avatar Hayrullah GÜVEN avatar  avatar  avatar

Watchers

James Cloos avatar Carlo Arnaboldi avatar  avatar

framework's Issues

Remove IDisposable

Remove our version of IDisposable.
Add extension method IsDisposed() which will try to cast a System.IDisposable to DisposableBase.

Version not as property

We should consider supporting version defined in other way than using a Version property.

  1. For some cases it could be detected from (type) name.

Add support for attributes in the TokenWriter

Add support for attributes in the TokenWriter. By using Format overload, which takes delegate with different argument, support attributes in the format string.

This way we can define template like "Hello, {Name DefaultValue=World!}". So if the name is specified, use it, other wise use default value attribute (this would be decided by the delegate passed to the Format method).

IConverterRepository and performance

IConverterRepository is great for single-use converting from/to different types. But when we want to convert from concrete type to concrete type multiple times, it can be quite slow, because of repetitive searching for converter.

We should introduce method GetConverter which would return Func<TSource, TTarget> or OutFunc<TSource, TTarget, bool> which could be used for multiple conversions.

The returned Func will behave just like the Converts.To and OutFunc like Converts.Try. We should also support for getting conversion (throws when to such converter) function and try-getting.

In-line command handlers

In a typical EventSourcing scenario, a command handler method a single line of code calling aggregate root method and passing in parameters.

So, we could simplify command handler implementation by registering a lambda method to execute.

Manual execution of scheduled commands

These commands are persisted using ICommandStore.
We need a way to load them, remove a ExecuteAt from envelope and schedule them again.

The last step should check whether a ISchedulingContexts with a same Key are scheduled and if, remove them from the queue.
Then run those commands/events like new ones.

Scheduled commands after long time

Timers doesn't support long term scheduling.

These commands should be stored in kind of queues checked periodically. So when scheduling command for 3 months, instead of creating Timer, place it in the queue that will be checked tomorrow.

Key type resolver

We need a mechanism for transferring type (aka C# class) to IKey.Type and back.
Also this should be used to test if passed key is of required type.

Event stream visualization

We should support two scenarios, which share a common logic.

  1. Live visualization of event stream.
  • Best suited for rare cases.
  • Need for enumeration of aggregates.
  1. Build projection for stream visualization.
  • Need for building separate projection.
  • Performance agnostic.

In both modes, the outcome for every event should by a model with description and a list of properties, where each property has description and human readable (string) value.

Replaying events for rebuilding new/updated read-models

IEventStore should support replaying events in an order of creation on particular event handler to support rebuilding new/updated read model.

For simple scenarios it should support passing in the event handler instance. The event store should find which events are handled by this handler and replay those.

Refactoring IDependencyProvider and IDependencyContainer

  • Remove CreateChild from IDependencyProvider. Move it to extension method resolving IDependencyContainerFactory with Create(string) method.
  • Associate IDependencyCollection with concrete scope to add possibility to register "singletons" without explicitly passing current scope name.
  • Update Unity implementation.
  • Update Simple implementation.
  • Fix tests.

Performance counters

Add support for passing in a component that counts command execution duration.

Converter context

Add support for passing in the generic converter ICoverterContext. It should contain instance of IConverterRepository.

Event handling inside AggregateRoot

When aggregates are public, they should not implement IEventHandler to support self events. This way someone can cast them and use PublishAsync method to change state.

We could use some conventions to find methods for apply state.

Add TwoWayConverter

Add TwoWayConverter<T1, T2> for converters that support conversions from T1 to T2 and also from T2 to T1.

Logging

Add optional ILog parameter and support logging.

We need to log every handled event and command on every handler, whether it failed or succeeded. It could be also be beneficial to log registrations.

Infrastructure builder

Create infrastructure builder full of extension methods for instantiating CQRS infrastructure.

Add support for validating Commands just before execution.

We could use IValidationDispatcher in the PersistentCommandDispatcher to validate command just before passing it the ICommnadHandler.

It not CQRS by nature, but we can benefit here in some scenarios.

  1. Commands can be created directly from the client application.
  2. Commands can be created as POCO and then validated.
  3. Some of the logic currently placed in aggregates, can be moved here.

In the first two use-cases, the command validation can be run before placing command to the processing queue.
In the last one, the validation must be executed just before passing command to the handler.

Add transaction support

Stores must support optional transactions. Also, these transactions must be transferable to the handler implementations.

Add Reprocess to the TryCatch

TODO

  • Async variants.
  • Class ReprocessAsync with delay and returning tasks in all methods.
  • Unify interface for TryCatch and Reprocess.

Command persistent delivery causes duplicated calls to the ICommandStore.

When processing commands from ProcessRoot, these commands are stored in the ICommandStore twice. First call is from the ProcessRootRepository where all pending commands are stored. The second one is from PersistentCommandDispatcher where each command is persisted.

There are two possible solutions. The first one is to leave this problem to the implementation of ICommandStore. Here's one problem with the doubled serialization of a command.

The second one is to pass some flag to the persistent dispatcher to skip persisting these commands. It could be through some parameter in the envelope.

Auditing

Add options for extending an Envelope metadata by useful auditing information.
This way we can opt-in an execution timestamp or user identifier of user who invoked the operation.

IApplicationContext

IApplicationContext, aka returning to the Engine.Environment.

  • General/framework classes must provide constructor with parameters.
  • Optionally there would be a second constructor taking IApplicationContext.
  • There must not be default constructor using static instance of the IApplicationContext (no static app context).

The Keys used in the extension methods must go from the most concrete to more general. E.g.: We can register "global" formatter under key "Formatter". Then, in the event sourcing, when we try to resolve formatter, we should search for "EventSourcing.Events.Formatter", then "EventSourcing.Formatter" and at last "Formatter". This way, we can create more and more specific services.

So the context must be hierarchical. Every level in the hierarchy will have reference for the parent and the service finding will probe to the higher levels until the service is found.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.