Coder Social home page Coder Social logo

projac's Introduction

Projac

Projac is a set of .NET libraries that allow you to author projections targeting various backing stores and is easy to integrate with existing event stores such as EventStore and SQLStreamStore. Join the chat at https://gitter.im/yreynhout/Projac

It's available on both NuGet & MyGet:

The custom MyGet feed can be found here.


Important Changes

If you're using a version prior to 0.1.0, not only has your cheese been moved, it probably has been broken in unexpected places. Please check out the changes made in 0.1.0 as well as the how do I upgrade to 0.1.0 guide. If you want to keep your cheese as is, you can always fork this code base and use the legacy branch.


Contributions

  • Date, DateTime, DateTime2, Money data types in TSql by @xt0rted
  • The positional syntax suggestion by @tojans.
  • Decimal data type in SqlClientSyntax by @ritasker

projac's People

Contributors

danielmarbach avatar gitter-badger avatar mauricedb avatar ritasker avatar xt0rted avatar yreynhout avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

projac's Issues

Anonymous sql projection

Introduce the notion of an anonymous SqlProjection, i.e. a sql projection for which the handlers are not declared using a derived class (e.g. the sql projection builder comes to mind). Integrate this with the SqlProjectionBuilder.

Not all data types are available on the TSql class

While setting up some new projections I found that Paramol is missing some of the data types my schema uses such as DateTime, DateTime2, and Money. I've added support for these locally following the built-in types. Would you like a pull request for any of these?

Add a testing library for Projac.Connector

Something like ...

public class PortfolioProjectionTests
{
  public void when_adding_a_portfolio()
  {
    new ConnectedProjectionScenario<IAsyncDocumentSession>(new PortfolioProject()).
      When(new PortfolioAdded { PortfolioId = 123, Name = "Picasso" }).
      Verify(client => async {
        if((await client.
          LoadAsync<PortfolioDocument>(123)).
          Equals(new PortfolioDocument { Id = 123, Name = "Picasso" }))
        {
          return VerificationResult.Pass();
        }
        return VerificationResult.Fail("Boohoo, projection failed.");
      }).
      Assert();
  }
}

Reorganization

  • Projac becomes Projac.Sql assembly/package/namespace
  • Move common Paramol types into Projac.Sql package/assembly/namespace
  • Move SqlClient specific types to new Projac.SqlClient package/assembly/namespace
  • Move SQLite specific types to new Projac.SQLite package/assembly/namespace
  • Projac.Connector becomes Projac assembly/package/namespace
  • Drop Connector and Connected prefix/suffix.

Update to netstandard

Project.Connector doesn't have much in the way of dependencies so it might as well upgrade to netstandard

Make code more explicit

I was planning on writing a simple pull request, and while I love your articles on your blog, I think this code is designed in a wrong way; it looks way to implicit at this moment. It is really hard to figure out what the intention is; you should make it more explicit if you would like to receive some pull requests...

Sorry man, I hope you do not take it personal, but I was expecting more from you...

Here is a graph that might help you out a bit more:

Testing api for SQL based projections

Brainstorming

    public class SqlProjectionScenarioBuilder
    {

    }

    public interface ISqlProjectionScenarioInitialState
    {
        ISqlProjectionScenarioGivenState Given(IEnumerable<object> messages);
        ISqlProjectionScenarioGivenState Given(object[] messages);
        ISqlProjectionScenarioGivenState Given(object message);
    }

    public interface ISqlProjectionScenarioGivenState
    {
        ISqlProjectionScenarioGivenState Given(IEnumerable<object> messages);
        ISqlProjectionScenarioGivenState Given(object[] messages);
        ISqlProjectionScenarioGivenState Given(object message);

        ISqlProjectionScenarioExpectState ExpectEmptyResultSet(SqlQueryCommand command);
        ISqlProjectionScenarioExpectState ExpectNonEmptyResultSet(SqlQueryCommand command);
        ISqlProjectionScenarioExpectState ExpectRowCount(SqlQueryCommand command, int count);
        ISqlProjectionScenarioExpectState ExpectScalarValue(SqlQueryCommand command, object value);
    }

    public interface ISqlProjectionScenarioExpectState
    {
        ISqlProjectionScenarioExpectState ExpectEmptyResultSet(SqlQueryCommand command);
        ISqlProjectionScenarioExpectState ExpectNonEmptyResultSet(SqlQueryCommand command);
        ISqlProjectionScenarioExpectState ExpectRowCount(SqlQueryCommand command, int count);
        ISqlProjectionScenarioExpectState ExpectScalarValue(SqlQueryCommand command, object value);

        SqlProjectionScenario Build();
    }

    public interface IExpectation
    {
        VerificationResult Verify(ConnectedTransactionalSqlCommandExecutor executor);
        Task<VerificationResult> VerifyAsync(ConnectedTransactionalSqlCommandExecutor executor);
    }

    public class VerificationResult
    {
    }

    public class SqlProjectionScenario
    {
    }

Contravariance + interfaces for Whens?

Does projac currently support interfaces and / or contravariance in interfaces? Example:

public interface Envelope { string StreamId {get;} }
public interface Envelope<out T> : Envelope { T Message {get;} }

public class EnvelopeImpl<T> : Envelope<T>{
   ...
}


return new SqlProjectionBuilder()
                .When<Envelope<SomeEvent>>(x =>
                {
                    Console.WriteLine("there");
                    return new SqlNonQueryCommand(...);
                })

It seems like When<Envelope> and When<Envelope<SomeEvent>> are not triggered. Only When<EnvelopeImpl<SomeEvent>> is. That wouldn't be a problem if When<EnvelopeImple<SomeEventInterface>> worked, but that doesn't either.

The scenario I'm targeting is this:

public class SomeEvent1 : SomethingStarted
{
}

public class SomeEvent2 : SomethingStarted
{
}

public interface SomethingStarted
{
    //some props
}

And I'm looking to have a projection for all Envelope<SomethingStarted> events. Is this possible?

Replace When with Handle

This is a cosmetic, yet breaking change on the way to 1.0. While debatable if needed it is the more predominant term used.

Deprecating SqlProjectionDescriptor & messages

After having used this "thing" for a while, it's become clear that it doesn't provide all that much value. It's also an area where there are bound to be a lot of opinions on/options of doing things differently. The idea is to give a SqlProjection an identifier, and that's it. Anything more fancy will be up to the user of the Projac library.

Along with the SqlProjectionDescriptor, I'll also be deprecating the built-in DDL messages, since that's again an area where you could be doing the same thing in a variety of ways. Don't get me wrong, the basic idea of it is still sound, it's just not something that should be in the box. More of a recipe (at best).

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.