Coder Social home page Coder Social logo

ddd-workshop's Introduction

DDD-Workshop

DDD Workshop - 05/30/2015 - Iteration zero

This is iteration zero of a solution that will be used during the DDD-Workshop. In this solution we are concentrating on the back-end and specifically on the domain thus the solution does not contain a UI. The client to test our application will be Postman (REST client). The solution makes use of

  • SQL Server Express as a data store,
  • NHibernate as the ORM,
  • Fluent NHibernate for the mapping
  • StructureMap as the IoC container
  • ASP.NET Web API
  • Log4Net for logging

##Prerequisites To successfully run the Iteration zero project we assume that your system is prepared and contains the following

  • Windows 7 or higher
  • Microsoft SQL Server Express 2012 or equivalent
  • Visual Studio 2013 Professional
  • SQL Server Management Studio
  • Git - e.g. msysgit, GitHub client for Windows or Source Tree
  • Google Chrome
  • Postman REST client for Chrome (or equivalent)

##How to get started Clone the repository from GitHub https://github.com/gnschenker/DDD-Workshop to your local computer.

Open a Powershell console and navigate to the folder to which you cloned the repository. To build the solution and run all tests we are using a Powershell build file that uses Psake.

Run the command .\psake\psake.ps1 .\build.ps1 Test

Or you can also double click the batch file ClickToBuild.cmd in the project folder which will also build the solution and run all tests

##DDD - Implementation In this sample we use the following implementation

Domain

Requests (or commands) flow through the controller which delegates them to the application service. The application service is the host for the aggregate and uses a repository to (re-) hydrate the aggregate from the data store and save the changes back to the data store. The aggregate contains all the business logic. The state of the aggregate is private to the aggregate and represents the entity that is persisted in the DB using the repository and NHibernate. Thus the State is the NHibernate entity.

##Sample code Iteration zero contains a SamplesController, SamplesApplicationService, SamplesAggregate and Sample (=state) as a template and to show how things are fitting together.

Try to run the application and use Postman to execute the following 2 GET requests

localhost:4000/api/samples [GET]
localhost:4000/api/samples/<sampleId> [GET]

Now also try some POST requests. To start a sample use this URL

localhost:4000/api/samples/start [POST]

define a header

content/type  application/json

and a (raw) body

{ name: "Some sample 1" }

and then the next step

localhost:4000/api/samples/<sampleId>/next [POST]

and a (raw) body

{ someDate: "2015-05-21" }

ddd-workshop's People

Contributors

gnschenker avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

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.