Skip to content
Dmitry Savchenko edited this page Jul 15, 2016 · 14 revisions

So, we proceed to the implementation of our application. The first phase of building the application is to create solution structure and to add the projects to it. The solution will be called Example and, as was already mentioned in the Introduction, will have 3 projects. We begin with the project that is responsible for business logic of the application - Domain.

Create class library Domain.

Domain

Then we proceed to the front-end – create and install ASP.NET Web Application UI with links to the MVC packages as template, empty project.

UI1

UI2

Finally, we add class library UnitTests that is responsible for unit testing.

UnitTests

Note: Although unit tests are not an obligatory part of the application, we recommend you to cover the code with tests because it will help to avoid numerous problems in future with various possible faults in the code due to test automation.

After having finished all the above activities, you will get following solution:

Solution

After we create the solution structure, we need to install Incoding Framework package.

The installation carried out by Nuget. There is the same algorithm of installation for all the projects:

  1. Right-click the project and select Manage Nuget Packages… in the context menu
  2. Search incoding
  3. Select necessary package and install it

First install Incoding framework in Domain.

Incoding_framework_1

Then add to the file Domain -> Infrastructure -> Bootstrapper.cs link to StructureMap.Graph.

StructureMap_ref

2 packages must be installed to UI:

  1. Incoding Meta Language
  2. Incoding Meta Language Contrib

Incoding_Meta_Languge

MetaLanguageContrib_install

Note: make sure that the 'Copy Local' property is set to 'true' in the References -> System.Web.Mvc.dll

Now change the file Example.UI -> Views -> Shared -> _Layout.cshtml so that it looks as follows:

``` @using Incoding.MvcContrib <title></title> <script type="text/javascript" src="@Url.Content("~/Scripts/jquery-1.9.1.min.js")"> </script> <script type="text/javascript" src="@Url.Content("~/Scripts/jquery-ui-1.10.2.min.js")"></script> <script type="text/javascript" src="@Url.Content("~/Scripts/underscore.min.js")"> </script> <script type="text/javascript" src="@Url.Content("~/Scripts/jquery.form.min.js")"> </script> <script type="text/javascript" src="@Url.Content("~/Scripts/jquery.history.js")"> </script> <script type="text/javascript" src="@Url.Content("~/Scripts/jquery.validate.min.js")"> </script> <script type="text/javascript" src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")"> </script> <script type="text/javascript" src="@Url.Content("~/Scripts/handlebars-1.1.2.js")"> </script> <script type="text/javascript" src="@Url.Content("~/Scripts/incoding.framework.min.js")"> </script> <script type="text/javascript" src="@Url.Content("~/Scripts/incoding.meta.language.contrib.js")"> </script> <script type="text/javascript" src="@Url.Content("~/Scripts/bootstrap.min.js")"> </script> <script> TemplateFactory.Version = '@Guid.NewGuid().ToString()'; </script> @Html.Incoding().RenderDropDownTemplate() @RenderBody() ```

Then add the link to Bootstrapper.cs to the files Example.UI -> App_Start -> IncodingStart.cs and Example.UI -> Controllers -> DispatcherController.cs.

IncodingStart_bootstrapper

DispatcherController_bootstrapper

Note: If you use MVC5, it’s necessary for framework to add following code to Web.config file.

``` ```

Now install Incoding tests helpers package in UnitTests and add the link to Example.Domain.Bootstrapper.cs in Example.UnitTests -> MSpecAssemblyContext.cs.

Incoding_tests_helpers

MSpecAssemblyContext_bootstrapper

The last phase of the preparation the projects to work is to create folders structure for the projects.

Add following folders to the Domain project:

  1. Operations – command and query of the project
  2. Persistences – entities for DB mapping

Example.Domain_folders

In the UnitTests project create just the same folders structure as in Domain project and add folder Specifications - we will store tests for specifications there.

UnitTests_folders


Clone this wiki locally