Ncqrs moved to GitHub & Google Groups
Multiple people requested this and it’s now official, the source code of Ncqrs has been moved to GitHub. Thanks to Tjeerd Hans Terpsta for migrating the source repository from Mercurial to Git without loosing any history. We also moved to Google Groups for discussions, since GitHub does not provide a discussion board.
Since we moved to Git Arnis Lapsa already wrote a SQLite event store and Chris Chilvers fixed a bug. We encourage users fork Ncqrs code, make changes, commit them to your forked repository, and submit pull requests.
New URLs
New to Git?
If you are new to Git, I recommend watching the video of the Google TechTalk about Git from Randal Schwartz. Also Jason Meridth posted a great series called Git For Windows Developers.
Recommended tools
Here is a list of tools we recommend to Windows developers:
- msysgit – Git on Windows
- GitExtension – great UI for Git and integrates with Visual Studio
Ncqrs reference documentation
A framework is nothing without proper documentation. Since we are getting close to a next release where the Ncqrs framework gets ready for the real work we started working on documentation. Although the current version of the documentation is far from final we want to share this already. It could already contain some information you are looking for.
The reference documentation will grow in the future and like the code we guess that is will never be done.
Go check it out: http://ncqrs.org/reference
Code Contract rewriter problems
It could be that if you try to run the sample application you get a big bad nasty assertion when the website starts. The assertion displays the message: “Must use rewriter when using Contract.Requires<TException>”. In this post you find the background of this error and how to solve it.
Background
The Ncqrs Framework uses Code Contracts to make sure things go as they have been planned to be. For precondition that are related to parameters, we use the Contract.Requires<TException> method. This method adds runtime validation of the preconditions and throws an exception when they where not satisfied. But to do this, the code has to be rewritten on compile time. That means, emitting the assertion check in the method. By default, runtime code contract checking it turned of for project. Unfortunately it looks like that this setting is not saved into the .csproj project file. So, to solve the problem you need to enable runtime code contract checking for every project in the Ncqrs Framework.
Solving the problem
You need to enable runtime code contract checking for every project in the Framework folder of the Ncqrs solution. You can do this by following these steps:
- Open the Ncqrs.sln file.
- Now, for all project in the Framework folder:
- Open the project properties by right clicking on the project item in the solution explorer and then click on the Properties menu item.
- Click on the Code Contract property tab.
- Check the Perform Runtime Code Contract Checking checkbox.
- Also make sure the combobox after this checkbox is set to FULL.
In the end the code contracts project pane should look like this for every project in the Framework solution folder:
Credits
We would like to thank @arnodenuijl and @Survivor_Zero for reporting this problem.
What is the Ncqrs Framework?
The Ncqrs Framework helps you to build scalable applications that are based on the architectural pattern called Command Query Responsibility Segregation. It offers all the components to enable command execution, domain components, event sourcing, audit trailing, event publishing and denormalization in your system. Furthermore it tries to help with convention and annotation support to take away plumbing code by helps you to easily map command directly to aggregate creation or an aggregate root operation, or to define event handlers in your aggregates in no time.
The goals
The main goals of the Ncqrs Framework is helping you to build scalable applications according to the CQRS architecture concepts by offering a strong and robust framework that offers main components, infrastructure and takes away plumbing code by support for annotation and convention.
Framework status
At the moment we offer only one release and that is a code only release. This is because Ncqrs should now only be used by people that got the balls to compile it them self and use it without proper documentation. The framework itself offers the most important infrastructure to build CQRS based applications, but lags good documentation. But that is where this blog, twitter and direct email contact come around.
Features
- Rich components to support a full CQRS architecture.
- Easy Command mapping.
- Domain event mapping.
- Event sourcing support.
- Event storage with MSSQL or MongoDB support.
- Sample application that show a simple CQRS based application.
- Easy to extend!
Details
The project is hosted at Codeplex. Releases can be found here and you can visit this page to see the changesets in the source control repository. The Mercurial source repository can be found here:
Clone URL: https://hg01.codeplex.com/ncqrs
More information about CQRS
For more information about the CQRS principles we refer to the following resources:
Running the sample application
There is a little sample application that you can explore to see how the Ncqrs Framework works. Read the quick readme here: Running the sample application
Running the sample application
Beside the Ncqrs framework itself, the project also contains a small sample application. This sample application gives you a nice overview of a project that contains all the main elements of the (n)cqrs based application. It contains a command service, domain, event store, event bus, demoralizers, and a simple read model.
Steps to get it running
To run the sample application you need Visual Studio 2010 and Code Contracts. If you have that installed, it will not take you more than 5 minutes to get the sample application running; otherwise, I’ll buy you a beer!
Get and build the source
- First download the latest release here and unpack.
- Open the solution Ncqrs.sln that is located in the /src/ directory.
- After the solution opened you should compile the solution.
- Make sure everything compiled correctly and that there where no build errors.
Get and run MongoDB
- Download MongoDB 1.4.0 for windows here.
- Unpack all the content in the bin folder to c:\mongodb\.
- Create the following folder c:\data\db
- Start a Command Shell (cmd.exe) and cd to c:\mongodb\.
- Now enter mongod.exe and hit enter.
Run it!
- Set Sample.UI as startup project.
- Now you can just run the Sample.UI by hitting F5 in Visual Studio.