Skip to content
Dmitry Savchenko edited this page Jul 14, 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/p>

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 UnitTests are not an obligatory part of the application, we recommend you to cover the code with tests as 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 from Nuget.

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 the 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
<!DOCTYPE html>
<html >
<head>
    <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>
    <link rel="stylesheet" type="text/css" href="@Url.Content("~/Content/bootstrap.min.css")">
    <link rel="stylesheet" type="text/css" href="@Url.Content("~/Content/themes/base/jquery.ui.core.css")">
    <link rel="stylesheet" type="text/css" href="@Url.Content("~/Content/themes/base/jquery.ui.datepicker.css")">
    <link rel="stylesheet" type="text/css" href="@Url.Content("~/Content/themes/base/jquery.ui.dialog.css")">
    <link rel="stylesheet" type="text/css" href="@Url.Content("~/Content/themes/base/jquery.ui.theme.css")">
    <link rel="stylesheet" type="text/css" href="@Url.Content("~/Content/themes/base/jquery.ui.menu.css")">
    <script>
        TemplateFactory.Version = '@Guid.NewGuid().ToString()';
    </script>
</head>
@Html.Incoding().RenderDropDownTemplate()
<body>
@RenderBody()
</body>
</html>

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.

<dependentAssembly>
  <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
  <bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
</dependentAssembly>

Now install  Incoding tests helpers inUnitTests and add the link to 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 Example.Domain project:

  1. Operations – command and query of the project
  2. Persistences – entities for DB mapping
  3. Specifications – where and order specifications for data cleaning when request is made

Example.Domain_folders

In the Example.UnitTests project create just the same folders structure as in Example.Domain.

UnitTests_folders

Clone this wiki locally