{"id":265680,"date":"2015-09-15T16:10:03","date_gmt":"2015-09-15T12:10:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=265680"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=265680","title":{"rendered":"Incoding Framework \u2014 Get started"},"content":{"rendered":"<p>       <a href=\"http:\/\/incframework.com\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/001\/77f\/d8e\/00177fd8e91cac6509c2a30562a0dd50.png\" alt=\"IncFramework-logo\" width=\"920\" height=\"398\"\/><\/a><br \/>  <em><strong>disclaimer:<\/strong>\u00a0\u0434\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0448\u0430\u0433\u043e\u0432\u044b\u043c \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c\u0438\u00a0<strong>Incoding Framework<\/strong>. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0443 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043a\u0440\u044b\u0442\u043e\u0435 \u044e\u043d\u0438\u0442-\u0442\u0435\u0441\u0442\u0430\u043c\u0438 <a href=\"https:\/\/github.com\/IncodingSoftware\/get-started\">\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/a>, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0435\u0435 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u0411\u0414 (CRUD + data filters). \u041e Incoding framework \u0440\u0430\u043d\u0435\u0435 \u0443\u0436\u0435 \u0431\u044b\u043b\u0438 \u0441\u0442\u0430\u0442\u044c\u0438 \u043d\u0430 habrahabr, \u043d\u043e \u0432 \u043d\u0438\u0445 \u0440\u0430\u0441\u043a\u0440\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0447\u0430\u0441\u0442\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430.<\/em><\/p>\n<h1>\u0427\u0430\u0441\u0442\u044c 0. \u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435.<\/h1>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043c \u043a\u0440\u0430\u0442\u043a\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u00a0\u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430<strong>.\u00a0<\/strong><strong>Incoding<\/strong> <strong>Framework<\/strong> \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0442\u0440\u0435\u0445 \u043f\u0430\u043a\u0435\u0442\u043e\u0432: Incoding framework \u2013 back-end \u043f\u0440\u043e\u0435\u043a\u0442\u0430, Incoding Meta Language \u2013 front-end \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0438 Incoding tests helpers \u2013 \u044e\u043d\u0438\u0442-\u0442\u0435\u0441\u0442\u044b \u0434\u043b\u044f back-end\u2019\u0430. \u042d\u0442\u0438 \u043f\u0430\u043a\u0435\u0442\u044b \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u0434\u0440\u0443\u0433 \u043e\u0442 \u0434\u0440\u0443\u0433\u0430, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0432 \u043f\u0440\u043e\u0435\u043a\u0442 \u0447\u0430\u0441\u0442\u044f\u043c\u0438: \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0443\u044e \u0438\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u0443\u044e \u0447\u0430\u0441\u0442\u044c (\u0442\u0435\u0441\u0442\u044b \u043e\u0447\u0435\u043d\u044c \u0441\u0438\u043b\u044c\u043d\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u044b \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u044c\u044e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0437\u0438\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435).<br \/>  \u0412 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u043d\u0430\u00a0<strong>Incoding Framework<\/strong>,<strong>\u00a0<\/strong>\u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u043e\u0439 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <a title=\"Martin Fowler: CQRS\" href=\"http:\/\/martinfowler.com\/bliki\/CQRS.html\">CQRS<\/a>. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <a title=\"Habrahabr: Incoding rapid development framework\" href=\"http:\/\/habrahabr.ru\/post\/209734\/\">Incoding Meta Language<\/a>. \u0412 \u0446\u0435\u043b\u043e\u043c\u00a0<strong>Incoding Framework\u00a0<\/strong>\u043f\u043e\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u0432\u0435\u0441\u044c \u0446\u0438\u043a\u043b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<br \/>  \u0422\u0438\u043f\u0438\u0447\u043d\u044b\u0439 solution, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e\u00a0<strong>Incoding Framework,\u00a0<\/strong>\u0438\u043c\u0435\u0435\u0442 3 \u043f\u0440\u043e\u0435\u043a\u0442\u0430:<\/p>\n<ol>\n<li><b>Domain (<em>class library) <\/em><\/b><em> \u2014 <\/em>\u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0443 \u0438 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445.<\/li>\n<li><b>UI (<em>ASP.NET MVC project<\/em>)<i>\u00a0<\/i><\/b><i>&#8212;\u00a0<\/i>\u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0430\u044f \u0447\u0430\u0441\u0442\u044c, \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u043d\u0430\u00a0ASP.NET MVC.<\/li>\n<li><strong>UnitTests (<em>class library<\/em>)\u00a0<\/strong> \u2014 \u044e\u043d\u0438\u0442-\u0442\u0435\u0441\u0442\u044b \u0434\u043b\u044f Domain.<\/li>\n<\/ol>\n<p>  <\/p>\n<h3>Domain<\/h3>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043f\u0430\u043a\u0435\u0442\u0430\u00a0<a title=\"Nuget: Incoding framework\" href=\"https:\/\/www.nuget.org\/packages\/Incoding.Framework\/\">Incoding framework<\/a>\u00a0\u0447\u0435\u0440\u0435\u0437 Nuget \u0432 \u043f\u0440\u043e\u0435\u043a\u0442 \u043f\u043e\u043c\u0438\u043c\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 dll \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0444\u0430\u0439\u043b Bootstrapper.cs. \u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u044d\u0442\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u2014 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f: \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f IoC, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430\u00a0\u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a Ajax-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0438 \u043f\u0440. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 IoC framework \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f <a title=\"StructureMap docs\" href=\"http:\/\/docs.structuremap.net\/\">StructureMap<\/a>, \u043e\u0434\u043d\u0430\u043a\u043e \u0435\u0441\u0442\u044c \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440 \u0434\u043b\u044f Ninject, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u0432\u043e\u0438\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439.<\/p>\n<pre><code class=\"cs\">namespace Example.Domain {     #region &lt;&lt; Using &gt;&gt;      using System;     using System.Configuration;     using System.IO;     using System.Linq;     using System.Web.Mvc;     using FluentNHibernate.Cfg;     using FluentNHibernate.Cfg.Db;     using FluentValidation;     using FluentValidation.Mvc;     using Incoding.Block.IoC;     using Incoding.Block.Logging;     using Incoding.CQRS;     using Incoding.Data;     using Incoding.EventBroker;     using Incoding.Extensions;     using Incoding.MvcContrib;     using NHibernate.Tool.hbm2ddl;     using StructureMap.Graph;      #endregion      public static class Bootstrapper     {         public static void Start()         {             \/\/Initialize LoggingFactory             LoggingFactory.Instance.Initialize(logging =&gt;                 {  string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, &quot;Log&quot;);  logging.WithPolicy(policy =&gt; policy.For(LogType.Debug).Use(FileLogger.WithAtOnceReplace(path,                                           () =&gt; &quot;Debug_{0}.txt&quot;.F(DateTime.Now.ToString(&quot;yyyyMMdd&quot;)))));                 });              \/\/Initialize IoCFactory             IoCFactory.Instance.Initialize(init =&gt;                   init.WithProvider(new StructureMapIoCProvider(registry =&gt;                 {                 registry.For&lt;IDispatcher&gt;().Use&lt;DefaultDispatcher&gt;();                 registry.For&lt;IEventBroker&gt;().Use&lt;DefaultEventBroker&gt;();                 registry.For&lt;ITemplateFactory&gt;().Singleton().Use&lt;TemplateHandlebarsFactory&gt;();                  \/\/Configure FluentlyNhibernate                 var configure = Fluently                        .Configure()                        .Database(MsSqlConfiguration.MsSql2008                 .ConnectionString(ConfigurationManager.ConnectionStrings[&quot;Example&quot;].ConnectionString))                        .Mappings(configuration =&gt; configuration.FluentMappings                                                      .AddFromAssembly(typeof(Bootstrapper).Assembly))                        .ExposeConfiguration(cfg =&gt; new SchemaUpdate(cfg).Execute(false, true))                        .CurrentSessionContext&lt;NhibernateSessionContext&gt;();                  registry.For&lt;INhibernateSessionFactory&gt;()                         .Singleton()                         .Use(() =&gt; new NhibernateSessionFactory(configure));                 registry.For&lt;IUnitOfWorkFactory&gt;().Use&lt;NhibernateUnitOfWorkFactory&gt;();                 registry.For&lt;IRepository&gt;().Use&lt;NhibernateRepository&gt;();                  \/\/Scan currenlty Assembly and registrations all Validators and Event Subscribers                 registry.Scan(r =&gt;                                     {                                 r.TheCallingAssembly();                                 r.WithDefaultConventions();                                 r.ConnectImplementationsToTypesClosing(typeof(AbstractValidator&lt;&gt;));                                 r.ConnectImplementationsToTypesClosing(typeof(IEventSubscriber&lt;&gt;));                                 r.AddAllTypesOf&lt;ISetUp&gt;();                                     });                 })));              ModelValidatorProviders.Providers                           .Add(new FluentValidationModelValidatorProvider(new IncValidatorFactory()));             FluentValidationModelValidatorProvider.Configure();              \/\/Execute all SetUp             foreach (var setUp in IoCFactory.Instance.ResolveAll&lt;ISetUp&gt;().OrderBy(r =&gt; r.GetOrder()))             {                 setUp.Execute();             }              var ajaxDef = JqueryAjaxOptions.Default;             ajaxDef.Cache = false; \/\/Disable Ajax cache         }     } } <\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u0432\u00a0<strong>Domain\u00a0<\/strong>\u0434\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b (Command) \u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u044b (Query), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 \u043b\u0438\u0431\u043e \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0434\u0440\u0443\u0433\u0438\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u043e\u0439 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<h3>UI<\/h3>\n<p>  \u041f\u0430\u043a\u0435\u0442 <a title=\"Nuget: Incoding Meta Language\" href=\"https:\/\/www.nuget.org\/packages\/Incoding.MetaLanguage\/\">Incoding Meta Language<\/a>\u00a0\u043f\u0440\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 dll, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0444\u0430\u0439\u043b\u044b IncodingStart.cs \u0438 DispatcherController.cs (\u0447\u0430\u0441\u0442\u044c <a title=\"Habrahabr: Model View Dispatcher (cqrs over mvc)\" href=\"http:\/\/habrahabr.ru\/post\/221585\/\">MVD<\/a>) \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 Domain.<\/p>\n<pre><code>public static class IncodingStart {     public static void source Start()     {         Bootstrapper.Start();         new DispatcherController(); \/\/ init routes     } }<\/code><\/pre>\n<p>  <\/p>\n<pre><code>public class DispatcherController : DispatcherControllerBase {     #region Constructors      public DispatcherController()             : base(typeof(Bootstrapper).Assembly) { }      #endregion }<\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0432 <strong>UI<\/strong>\u00a0\u0434\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0430\u044f \u043b\u043e\u0433\u0438\u043a\u0430 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c\u00a0<a title=\"Habrahabr: Incoding rapid development framework\" href=\"http:\/\/habrahabr.ru\/post\/209734\/\">IML<\/a>.<\/p>\n<h3>UnitTests<\/h3>\n<p>  \u041f\u0440\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 <a title=\"Nuget: Incoding tests helpers\" href=\"https:\/\/www.nuget.org\/packages\/Incoding.MSpecContrib\/\">Incoding tests helpers<\/a>\u00a0\u0432 \u043f\u0440\u043e\u0435\u043a\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0444\u0430\u0439\u043b MSpecAssemblyContext.cs, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f\u00a0connection \u043a \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<pre><code>public class MSpecAssemblyContext : IAssemblyContext {     #region IAssemblyContext Members      public void OnAssemblyStart()     {         \/\/\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0411\u0414         var configure = Fluently                 .Configure()                 .Database(MsSqlConfiguration.MsSql2008                          .ConnectionString(ConfigurationManager.ConnectionStrings[&quot;Example_Test&quot;].ConnectionString)                                             .ShowSql())                 .Mappings(configuration =&gt; configuration.FluentMappings.AddFromAssembly(typeof(Bootstrapper).Assembly));          PleasureForData.StartNhibernate(configure, true);     }      public void OnAssemblyComplete() { }      #endregion }<\/code><\/pre>\n<p>  <a name=\"habracut\"><\/a>  <\/p>\n<h2>\u0427\u0430\u0441\u0442\u044c 1. \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430.<\/h2>\n<p>  \u0418\u0442\u0430\u043a, \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c \u043a \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044e \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u0432\u00a0<em>disclamer\u00a0<\/em>\u0437\u0430\u0434\u0430\u0447\u0435\u00a0&#8212;\u00a0\u043d\u0430\u0447\u043d\u0435\u043c \u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435. \u041f\u0435\u0440\u0432\u044b\u0439 \u044d\u0442\u0430\u043f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u2014 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b solution&#8217;\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 projects \u0432 \u043d\u0435\u0433\u043e. Solution \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f\u00a0<strong>Example\u00a0<\/strong>\u0438, \u043a\u0430\u043a \u0443\u0436\u0435 \u0431\u044b\u043b\u043e \u0441\u043a\u0430\u0437\u0430\u043d\u043e \u0432\u043e \u0432\u0432\u0435\u0434\u0435\u043d\u0438\u0438, \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0442\u0440\u0438 projects. \u041d\u0430\u0447\u043d\u0435\u043c \u0441 project&#8217;\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u0437\u0430 \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u2014 \u0441\u00a0<strong>Domain.<\/strong><br \/>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c class library\u00a0<strong>Domain<\/strong>.<br \/>  <a href=\"http:\/\/blog.incframework.com\/wp-content\/uploads\/2015\/06\/Domain.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/251\/c4b\/394\/251c4b3943ef65e1612dcc1e0ac7ade6.png\" alt=\"Domain\" width=\"800\" height=\"553\"\/><\/a><br \/>  \u0414\u0430\u043b\u0435\u0435 \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u2014 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043a\u0430\u043a \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c\u044b\u0439 \u043f\u0443\u0441\u0442\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 ASP.NET Web Application\u00a0<b>UI\u00a0<\/b>\u0441 \u0441\u044b\u043b\u043a\u0430\u043c\u0438 \u043d\u0430 MVC packages.<br \/>  <a href=\"http:\/\/blog.incframework.com\/wp-content\/uploads\/2015\/06\/UI1.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/a88\/baf\/d25\/a88bafd253a237e4e15d767eb24080a3.png\" alt=\"UI1\" width=\"800\" height=\"553\"\/><\/a><\/p>\n<p>  <a href=\"http:\/\/blog.incframework.com\/wp-content\/uploads\/2015\/06\/UI2.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/ba6\/ea0\/034\/ba6ea0034a9722c33ca19faa73c2652c.png\" alt=\"UI2\" width=\"770\" height=\"540\"\/><\/a><br \/>  \u0418 \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u0434\u043e\u0431\u0430\u0432\u0438\u043c class library <strong>UnitTests,\u00a0<\/strong>\u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0443\u044e \u0437\u0430 \u044e\u043d\u0438\u0442-\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435.<br \/>  <a href=\"http:\/\/blog.incframework.com\/wp-content\/uploads\/2015\/06\/UnitTests.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/902\/05f\/7ea\/90205f7eae7496b7c85c92f1ea456564.png\" alt=\"UnitTests\" width=\"800\" height=\"553\"\/><\/a><br \/>  <em><strong>\u0412\u043d\u0438\u043c\u0430\u043d\u0438\u0435:\u00a0<\/strong>\u0445\u043e\u0442\u044f \u044e\u043d\u0438\u0442-\u0442\u0435\u0441\u0442\u044b \u0438 \u043d\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u044c\u044e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043c\u044b \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u043c \u0412\u0430\u043c \u0432\u0441\u0435\u0433\u0434\u0430 \u043f\u043e\u043a\u0440\u044b\u0432\u0430\u0442\u044c \u043a\u043e\u0434 \u0442\u0435\u0441\u0442\u0430\u043c\u0438, \u0442\u0430\u043a \u043a\u0430\u043a \u044d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0441 \u043e\u0448\u0438\u0431\u043a\u0430\u043c\u0438 \u0432 \u043a\u043e\u0434\u0435 \u0437\u0430 \u0441\u0447\u0435\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/em><\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u0432\u044b\u0448\u0435\u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 Solution:<br \/>  <a href=\"http:\/\/blog.incframework.com\/wp-content\/uploads\/2015\/06\/Solution.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/6d5\/457\/c3c\/6d5457c3cb3f8af01bcd2a9b4f6020c7.png\" alt=\"Solution\" width=\"664\" height=\"547\"\/><\/a><br \/>  \u041f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b Solution&#8217;\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043f\u0430\u043a\u0435\u0442\u044b\u00a0<strong>Incoding Framework\u00a0<\/strong>\u0438\u0437 Nuget \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 projects.<br \/>  \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0447\u0435\u0440\u0435\u0437 Nuget. \u0414\u043b\u044f \u0432\u0441\u0435\u0445 projects \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043e\u0434\u0438\u043d:<\/p>\n<ol>\n<li>\u041a\u043b\u0438\u043a\u043d\u0438\u0442\u0435 \u043f\u0440\u0430\u0432\u043e\u0439 \u043a\u043d\u043e\u043f\u043a\u043e\u0439 \u043f\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0443 \u0438 \u0432\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u043e\u043c \u043c\u0435\u043d\u044e \u043f\u0443\u043d\u043a\u0442\u00a0<strong>Manage Nuget Packages&#8230;<\/strong><\/li>\n<li>\u0412 \u043f\u043e\u0438\u0441\u043a\u0435 \u0432\u0432\u0435\u0434\u0438\u0442\u0435\u00a0<strong>incoding<\/strong><\/li>\n<li>\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u043d\u0443\u0436\u043d\u044b\u0439 \u043f\u0430\u043a\u0435\u0442 \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0435 \u0435\u0433\u043e<\/li>\n<\/ol>\n<p>  \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c <a title=\"Incoding framework\" href=\"https:\/\/www.nuget.org\/packages\/Incoding.Framework\/\">Incoding framework<\/a> \u0432 <strong>Domain<\/strong>.<br \/>  <a href=\"http:\/\/blog.incframework.com\/wp-content\/uploads\/2015\/06\/Incoding_framework_1.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/c48\/b02\/a19\/c48b02a19609fdd5d8ec0fd31b19e819.png\" alt=\"Incoding_framework_1\" width=\"800\" height=\"539\"\/><\/a><br \/>  \u0414\u0430\u043b\u0435\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u0444\u0430\u0439\u043b <strong>Domain -&gt; Infrastructure -&gt; Bootstrapper.cs<\/strong> \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 StructureMap.Graph.<br \/>  <a href=\"http:\/\/blog.incframework.com\/wp-content\/uploads\/2015\/06\/StructureMap_ref.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/55a\/150\/966\/55a150966b3de3fb21a922369659771d.png\" alt=\"StructureMap_ref\" width=\"800\" height=\"63\"\/><\/a><\/p>\n<p>  \u0412\u00a0<strong>UI\u00a0<\/strong>\u043d\u0443\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0434\u0432\u0430 \u043f\u0430\u043a\u0435\u0442\u0430:  <\/p>\n<ol>\n<li><a title=\"Nuget: Incoding Meta Language\" href=\"https:\/\/www.nuget.org\/packages\/Incoding.MetaLanguage\/\">Incoding Meta Language<\/a><\/li>\n<li><a title=\"Nuget: Incoding Meta Language Contrib\" href=\"https:\/\/www.nuget.org\/packages\/Incoding.MetaLanguage.Contrib\/\">Incoding Meta Language Contrib<\/a><\/li>\n<\/ol>\n<p>  <strong><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/0f8\/bc7\/5a0\/0f8bc75a081ff4ba275d77a3d3b5cc85.png\" alt=\"Incoding_Meta_Languge\" width=\"800\" height=\"539\"\/><\/strong><br \/>  <a href=\"http:\/\/blog.incframework.com\/wp-content\/uploads\/2015\/06\/MetaLanguageContrib_install.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/a5a\/5d0\/99f\/a5a5d099f97ad1efe2ee0d6fe3c48c34.png\" alt=\"MetaLanguageContrib_install\" width=\"800\" height=\"539\"\/><\/a><br \/>  <b><i>\u0412\u043d\u0438\u043c\u0430\u043d\u0438\u0435:\u00a0<\/i><\/b><i>\u0443\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0434\u043b\u044f References -&gt; System.Web.Mvc.dll \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u00abCopy Local\u00bb \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e \u0432 \u00abtrue\u00bb<\/i><br \/>  \u0422\u0435\u043f\u0435\u0440\u044c \u0444\u0430\u0439\u043b\u00a0<strong>Example.UI -&gt; Views -&gt; Shared -&gt; _Layout.cshtml\u00a0<\/strong>\u0438\u0437\u043c\u0435\u043d\u0438\u0442\u0435 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u043b \u0442\u0430\u043a:<\/p>\n<pre><code>@using Incoding.MvcContrib &lt;!DOCTYPE html&gt; &lt;html &gt; &lt;head&gt;     &lt;script type=&quot;text\/javascript&quot; src=&quot;@Url.Content(&quot;~\/Scripts\/jquery-1.9.1.min.js&quot;)&quot;&gt; &lt;\/script&gt;     &lt;script type=&quot;text\/javascript&quot; src=&quot;@Url.Content(&quot;~\/Scripts\/jquery-ui-1.10.2.min.js&quot;)&quot;&gt;&lt;\/script&gt;     &lt;script type=&quot;text\/javascript&quot; src=&quot;@Url.Content(&quot;~\/Scripts\/underscore.min.js&quot;)&quot;&gt; &lt;\/script&gt;     &lt;script type=&quot;text\/javascript&quot; src=&quot;@Url.Content(&quot;~\/Scripts\/jquery.form.min.js&quot;)&quot;&gt; &lt;\/script&gt;     &lt;script type=&quot;text\/javascript&quot; src=&quot;@Url.Content(&quot;~\/Scripts\/jquery.history.js&quot;)&quot;&gt; &lt;\/script&gt;     &lt;script type=&quot;text\/javascript&quot; src=&quot;@Url.Content(&quot;~\/Scripts\/jquery.validate.min.js&quot;)&quot;&gt; &lt;\/script&gt;     &lt;script type=&quot;text\/javascript&quot; src=&quot;@Url.Content(&quot;~\/Scripts\/jquery.validate.unobtrusive.min.js&quot;)&quot;&gt; &lt;\/script&gt;     &lt;script type=&quot;text\/javascript&quot; src=&quot;@Url.Content(&quot;~\/Scripts\/handlebars-1.1.2.js&quot;)&quot;&gt; &lt;\/script&gt;     &lt;script type=&quot;text\/javascript&quot; src=&quot;@Url.Content(&quot;~\/Scripts\/incoding.framework.min.js&quot;)&quot;&gt; &lt;\/script&gt;     &lt;script type=&quot;text\/javascript&quot; src=&quot;@Url.Content(&quot;~\/Scripts\/incoding.meta.language.contrib.js&quot;)&quot;&gt; &lt;\/script&gt;     &lt;script type=&quot;text\/javascript&quot; src=&quot;@Url.Content(&quot;~\/Scripts\/bootstrap.min.js&quot;)&quot;&gt; &lt;\/script&gt;     &lt;link rel=&quot;stylesheet&quot; type=&quot;text\/css&quot; href=&quot;@Url.Content(&quot;~\/Content\/bootstrap.min.css&quot;)&quot;&gt;     &lt;link rel=&quot;stylesheet&quot; type=&quot;text\/css&quot; href=&quot;@Url.Content(&quot;~\/Content\/themes\/base\/jquery.ui.core.css&quot;)&quot;&gt;     &lt;link rel=&quot;stylesheet&quot; type=&quot;text\/css&quot; href=&quot;@Url.Content(&quot;~\/Content\/themes\/base\/jquery.ui.datepicker.css&quot;)&quot;&gt;     &lt;link rel=&quot;stylesheet&quot; type=&quot;text\/css&quot; href=&quot;@Url.Content(&quot;~\/Content\/themes\/base\/jquery.ui.dialog.css&quot;)&quot;&gt;     &lt;link rel=&quot;stylesheet&quot; type=&quot;text\/css&quot; href=&quot;@Url.Content(&quot;~\/Content\/themes\/base\/jquery.ui.theme.css&quot;)&quot;&gt;     &lt;link rel=&quot;stylesheet&quot; type=&quot;text\/css&quot; href=&quot;@Url.Content(&quot;~\/Content\/themes\/base\/jquery.ui.menu.css&quot;)&quot;&gt;     &lt;script&gt;         TemplateFactory.Version = '@Guid.NewGuid().ToString()';     &lt;\/script&gt; &lt;\/head&gt; @Html.Incoding().RenderDropDownTemplate() &lt;body&gt; @RenderBody() &lt;\/body&gt; &lt;\/html&gt;<\/code><\/pre>\n<p>  \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 Bootstrapper.cs \u0432 \u0444\u0430\u0439\u043b\u044b\u00a0<b>Example.UI -&gt; App_Start -&gt; IncodingStart.cs\u00a0<\/b>\u0438\u00a0<strong>Example.UI -&gt; Controllers -&gt; DispatcherController.cs<\/strong>.<br \/>  <a href=\"http:\/\/blog.incframework.com\/wp-content\/uploads\/2015\/06\/IncodingStart_bootstrapper.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/161\/ce7\/62e\/161ce762e1c6224f7b6247b2fa9fc2c6.png\" alt=\"IncodingStart_bootstrapper\" width=\"400\" height=\"240\"\/><\/a><\/p>\n<p>  <a href=\"http:\/\/blog.incframework.com\/wp-content\/uploads\/2015\/06\/DispatcherController_bootstrapper.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/563\/6aa\/323\/5636aa323758eb5505795b8866d190cf.png\" alt=\"DispatcherController_bootstrapper\" width=\"712\" height=\"185\"\/><\/a><br \/>  <em><strong>\u0412\u043d\u0438\u043c\u0430\u043d\u0438\u0435: <\/strong>\u0435\u0441\u043b\u0438 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 MVC5, \u0442\u043e \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b framework&#8217;\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u0432 \u0444\u0430\u0439\u043b Web.config<\/em><\/p>\n<pre><code>&lt;dependentAssembly&gt;   &lt;assemblyIdentity name=&quot;System.Web.Mvc&quot; publicKeyToken=&quot;31bf3856ad364e35&quot; culture=&quot;neutral&quot; \/&gt;   &lt;bindingRedirect oldVersion=&quot;0.0.0.0-5.0.0.0&quot; newVersion=&quot;5.0.0.0&quot; \/&gt; &lt;\/dependentAssembly&gt;<\/code><\/pre>\n<p>  \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c\u00a0<a title=\"Nuget: Incoding tests helpers\" href=\"https:\/\/www.nuget.org\/packages\/Incoding.MSpecContrib\/\">Incoding tests helpers<\/a> \u0432\u00a0<strong>UnitTests\u00a0<\/strong>\u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c\u00a0\u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 Bootstrapper.cs \u0432\u00a0<strong>Example.UnitTests -&gt; MSpecAssemblyContext.cs.<\/strong><br \/>  <a href=\"http:\/\/blog.incframework.com\/wp-content\/uploads\/2015\/06\/Incoding_tests_helpers.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/4a1\/af4\/b4e\/4a1af4b4e1201a548550d17fe9fdb7a3.png\" alt=\"Incoding_tests_helpers\" width=\"800\" height=\"539\"\/><\/a><\/p>\n<p>  <a href=\"http:\/\/blog.incframework.com\/wp-content\/uploads\/2015\/06\/MSpecAssemblyContext_bootstrapper.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/f75\/a49\/6ef\/f75a496ef3f0535b0e149f27b9334e13.png\" alt=\"MSpecAssemblyContext_bootstrapper\" width=\"800\" height=\"116\"\/><\/a><br \/>  \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u044d\u0442\u0430\u043f \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u043a \u0440\u0430\u0431\u043e\u0442\u0435 \u2014 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u043f\u0430\u043f\u043e\u043a \u0434\u043b\u044f projects.<br \/>  \u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u0430\u043f\u043a\u0438 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u00a0<strong>Example.Domain:<\/strong><\/p>\n<ol>\n<li>Operations \u2014 command \u0438 query \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/li>\n<li>Persistences \u2014 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u0434\u043b\u044f \u043c\u0430\u043f\u043f\u0438\u043d\u0433\u0430 \u0411\u0414<\/li>\n<li>Specifications \u2014 where \u0438 order \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u0445<\/li>\n<\/ol>\n<p>  <a href=\"http:\/\/blog.incframework.com\/wp-content\/uploads\/2015\/06\/Example.Domain_folders.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/a7c\/df9\/48c\/a7cdf948c8a4af2357ad97314e25104b.png\" alt=\"Example.Domain_folders\" width=\"350\" height=\"154\"\/><\/a><br \/>  \u0412 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 <strong>Example.UnitTests<\/strong> \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0442\u0430\u043a\u0443\u044e \u0436\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u043f\u0430\u043f\u043e\u043a \u043a\u0430\u043a \u0438 \u0432 <strong>Example.Domain.<\/strong><br \/>  <a href=\"http:\/\/blog.incframework.com\/wp-content\/uploads\/2015\/06\/UnitTests_folders.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/c66\/207\/d0e\/c66207d0e4961fdc3ae05e4391c53e98.png\" alt=\"UnitTests_folders\" width=\"310\" height=\"172\"\/><\/a><\/p>\n<h1>\u0427\u0430\u0441\u0442\u044c 2. \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 DB connection.<\/h1>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0411\u0414, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0431\u0443\u0434\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c. \u041e\u0442\u043a\u0440\u043e\u0439\u0442\u0435\u00a0SQL Managment Studio \u0438 \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0434\u0432\u0435 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445: Example \u0438 Example_test.<br \/>  <a href=\"http:\/\/blog.incframework.com\/wp-content\/uploads\/2015\/06\/add_DB1.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/c79\/af4\/457\/c79af445757c11c285fc0b4112b97e0a.png\" alt=\"add_DB\" width=\"525\" height=\"291\"\/><\/a><br \/>  <a href=\"http:\/\/blog.incframework.com\/wp-content\/uploads\/2015\/06\/example_db.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/649\/c97\/66f\/649c9766fd95462d8a38313c4efca04d.png\" alt=\"example_db\" width=\"525\" height=\"471\"\/><\/a><br \/>  <a href=\"http:\/\/blog.incframework.com\/wp-content\/uploads\/2015\/06\/example_test_db.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/86e\/ac0\/102\/86eac01029dfe8feb89c0b91969ccd57.png\" alt=\"example_test_db\" width=\"525\" height=\"471\"\/><\/a><br \/>  \u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0411\u0414 \u0432 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c connection.\u00a0\u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0432 \u0444\u0430\u0439\u043b\u044b <strong>Example.UI -&gt;\u00a0Web.config<\/strong>\u00a0\u0438 <strong>Example.UnitTests -&gt;\u00a0app.config<\/strong>\u00a0connection string \u043a \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<pre><code>  &lt;connectionStrings&gt;     &lt;add name=&quot;Example&quot; connectionString=&quot;Data Source=INCODING-PC\\SQLEXsource SS;Database=Example;Integrated Security=false; User Id=sa;Password=1&quot; providerName=&quot;System.Data.SqlClient&quot; \/&gt;     &lt;add name=&quot;Example_Test&quot; connectionString=&quot;Data Source=INCODING-PC\\SQLEXsource SS;Database=Example_Test;Integrated Security=true&quot; providerName=&quot;System.Data.SqlClient&quot; \/&gt;   &lt;\/connectionStrings&gt;<\/code><\/pre>\n<p>  \u0412 \u0444\u0430\u0439\u043b\u0435\u00a0<strong>Example.Domain -&gt; Infrastructure -&gt; Bootstrapper.cs\u00a0<\/strong>\u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0439\u0442\u0435 \u043f\u043e \u043a\u043b\u044e\u0447\u0443 \u00abExample\u00bb \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f:<\/p>\n<pre><code>\/\/Configure FluentlyNhibernate var configure = Fluently         .Configure()         .Database(MsSqlConfiguration.MsSql2008.ConnectionString(ConfigurationManager                                                 .ConnectionStrings[&quot;Example&quot;].ConnectionString))         .Mappings(configuration =&gt; configuration.FluentMappings                                                 .AddFromAssembly(typeof(Bootstrapper).Assembly))         .ExposeConfiguration(cfg =&gt; new SchemaUpdate(cfg).Execute(false, true))         .CurrentSessionContext(); \/\/Configure data base <\/code><\/pre>\n<p>  \u0412 \u0444\u0430\u0439\u043b\u0435\u00a0<strong>Example.UnitTests -&gt; MSpecAssemblyContext.cs\u00a0<\/strong>\u00a0\u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0439\u0442\u0435 \u043f\u043e \u043a\u043b\u044e\u0447\u0443 \u00abExample_Test\u00bb \u0441\u0442\u0440\u043e\u043a\u0443 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u043e\u0432:<\/p>\n<pre><code>\/\/Configure connection to Test data base var configure = Fluently         .Configure()         .Database(MsSqlConfiguration.MsSql2008              .ConnectionString(ConfigurationManager.ConnectionStrings[&quot;Example_Test&quot;].ConnectionString)         .ShowSql())         .Mappings(configuration =&gt; configuration.FluentMappings                                                 .AddFromAssembly(typeof(Bootstrapper).Assembly)); <\/code><\/pre>\n<p>  <em><strong>\u0412\u043d\u0438\u043c\u0430\u043d\u0438\u0435:<\/strong> \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 Example \u0438 Example_Test \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c.<\/em><\/p>\n<h1>\u0427\u0430\u0441\u0442\u044c 3. CRUD.<\/h1>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u0432\u044b\u0448\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u043c\u044b \u043f\u043e\u0434\u043e\u0448\u043b\u0438\u00a0\u043a \u0441\u0430\u043c\u043e\u0439 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u2014 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u043a\u043e\u0434\u0430, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0435\u0433\u043e <strong>C<\/strong>reate<strong>R<\/strong>ead<strong>U<\/strong>pdate<strong>D<\/strong>elete-\u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.\u00a0\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u043c\u0430\u043f\u043f\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u0411\u0414. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 Human.cs, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u043f\u0430\u043f\u043a\u0443 <strong>Example.Domain -&gt; Persistences.<\/strong><\/p>\n<h6>Human.cs<\/h6>\n<p>  <\/p>\n<pre><code>namespace Example.Domain {     #region &lt;&lt; Using &gt;&gt;      using System;     using Incoding.Data;      #endregion      public class Human : IncEntityBase     {         #region Properties          public virtual DateTime Birthday { get; set; }          public virtual string FirstName { get; set; }          public virtual string Id { get; set; }          public virtual string LastName { get; set; }          public virtual Sex Sex { get; set; }          #endregion          #region Nested Classes          public class Map : NHibernateEntityMap&lt;Human&gt;         {             #region Constructors              protected Map()             {                 IdGenerateByGuid(r =&gt; r.Id);                 MapEscaping(r =&gt; r.FirstName);                 MapEscaping(r =&gt; r.LastName);                 MapEscaping(r =&gt; r.Birthday);                 MapEscaping(r =&gt; r.Sex);             }              #endregion         }          #endregion     }      public enum Sex     {         Male = 1,          Female = 2     } }<\/code><\/pre>\n<p>  \u041d\u0430\u0448 \u043a\u043b\u0430\u0441\u0441 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043b\u0435\u0439, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435, \u0438 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u043c\u0430\u043f\u043f\u0438\u043d\u0433\u0430 (<i>class Map).<\/i><br \/>  <em><strong>\u0417\u0430\u043c\u0435\u0442\u043a\u0430:<\/strong> \u043f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u0430 <strong>Human<\/strong> \u0412\u0430\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 (\u0434\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u043d\u0438\u0435 xml-\u043c\u0430\u043f\u043f\u0438\u043d\u0433\u0430) \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f <a title=\"Fluent Nhibernate\" href=\"http:\/\/www.fluentnhibernate.org\/\">FluentNhibernate<\/a>.<\/em><br \/>  \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u044b (Command) \u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u044b (Query), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u0437\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e CRUD-\u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439.\u00a0\u041f\u0435\u0440\u0432\u0430\u044f \u043a\u043e\u043c\u043c\u0430\u043d\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u0437\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0439 \u0438\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u0442\u0438\u043f\u0430 Human. \u041a\u043e\u043c\u043c\u0430\u043d\u0434\u0430 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u0430\u044f: \u043c\u044b \u043b\u0438\u0431\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0438\u0437 Repository \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c \u043f\u043e \u043a\u043b\u044e\u0447\u0443 (Id), \u043b\u0438\u0431\u043e, \u0435\u0441\u043b\u0438 \u0442\u0430\u043a\u043e\u0439 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u043d\u0435\u0442, \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u0443\u044e. \u0412 \u043e\u0431\u043e\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u044b \u0432 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u0445 \u043a\u043b\u0430\u0441\u0441\u0430 AddOrEditHumanCommand. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0444\u0430\u0439\u043b \u00a0<strong>Example.Domain -&gt; Operations -&gt; AddOrEditHumanCommand.cs\u00a0<\/strong>\u0432 \u043f\u0440\u043e\u0435\u043a\u0442.<\/p>\n<h6>AddOrEditHumanCommand.cs<\/h6>\n<p>  <\/p>\n<pre><code>namespace Example.Domain {     #region &lt;&lt; Using &gt;&gt;      using System;     using FluentValidation;     using Incoding.CQRS;     using Incoding.Extensions;      #endregion      public class AddOrEditHumanCommand : CommandBase     {         #region Properties          public DateTime BirthDay { get; set; }          public string FirstName { get; set; }          public string Id { get; set; }          public string LastName { get; set; }          public Sex Sex { get; set; }          #endregion          public override void Execute()         {             var human = Repository.GetById&lt;Human&gt;(Id) ?? new Human();              human.FirstName = FirstName;             human.LastName = LastName;             human.Birthday = BirthDay;             human.Sex = Sex;              Repository.SaveOrUpdate(human);         }     } }<\/code><\/pre>\n<p>  \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0447\u0430\u0441\u0442\u044c CRUD \u2014 Read \u2014 \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u0435 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439 \u0438\u0437 \u0431\u0430\u0437\u044b.\u00a0\u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0444\u0430\u0439\u043b\u00a0<strong>Example.Domain -&gt; Operations -&gt; GetPeopleQuery.cs.<\/strong><\/p>\n<h6>GetPeopleQuery.cs<\/h6>\n<p>  <\/p>\n<pre><code>namespace Example.Domain {     #region &lt;&lt; Using &gt;&gt;      using System.Collections.Generic;     using System.Linq;     using Incoding.CQRS;      #endregion      public class GetPeopleQuery : QueryBase&lt;List&lt;GetPeopleQuery.Response&gt;&gt;     {         #region Properties          public string Keyword { get; set; }          #endregion          #region Nested Classes          public class Response         {             #region Properties              public string Birthday { get; set; }              public string FirstName { get; set; }              public string Id { get; set; }              public string LastName { get; set; }              public string Sex { get; set; }              #endregion         }          #endregion          protected override List&lt;Response&gt; ExecuteResult()         {             return Repository.Query&lt;Human&gt;().Select(human =&gt; new Response                                                                  {                                                                          Id = human.Id,                                                                          Birthday = human.Birthday.ToShortDateString(),                                                                          FirstName = human.FirstName,                                                                          LastName = human.LastName,                                                                          Sex = human.Sex.ToString()                                                                  }).ToList();         }     } }<\/code><\/pre>\n<p>  \u0418 \u043e\u0441\u0442\u0430\u0432\u0448\u0430\u044f\u0441\u044f \u0447\u0430\u0441\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430 \u2014 \u044d\u0442\u043e Delete \u2014 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0438\u0437 \u0411\u0414 \u043f\u043e \u043a\u043b\u044e\u0447\u0443 (Id). \u00a0\u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0444\u0430\u0439\u043b\u00a0<strong>Example.Domain -&gt; Operations -&gt; DeleteHumanCommand.cs.<\/strong><\/p>\n<h6>DeleteHumanCommand.cs<\/h6>\n<p>  <\/p>\n<pre><code>namespace Example.Domain {     #region &lt;&lt; Using &gt;&gt;      using Incoding.CQRS;      #endregion      public class DeleteHumanCommand : CommandBase     {         #region Properties          public string HumanId { get; set; }          #endregion          public override void Execute()         {             Repository.Delete&lt;Human&gt;(HumanId);         }     } }<\/code><\/pre>\n<p>  \u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0411\u0414 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0444\u0430\u0439\u043b\u00a0<strong>Example.Domain -&gt; InitPeople.cs\u00a0<\/strong> \u2014 \u044d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442\u0441\u044f \u043e\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 ISetUp.<\/p>\n<h6>ISetup<\/h6>\n<p>  <\/p>\n<pre><code>using System;  namespace Incoding.CQRS {   public interface ISetUp : IDisposable   {     int GetOrder();      void Execute();   } }<\/code><\/pre>\n<p>  \u0412\u0441\u0435 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b \u043a\u043b\u0430\u0441\u0441\u043e\u0432, \u0443\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043e\u0442 ISetUp, \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 IoC \u0432 Bootstrapper.cs (\u0431\u044b\u043b \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u0432\u043e \u0432\u0432\u0435\u0434\u0435\u043d\u0438\u0438). \u041f\u043e\u0441\u043b\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u043e\u043d\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 (public void Execute()) \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443 (public int GetOrder()).<\/p>\n<h6>InitPeople.cs<\/h6>\n<p>  <\/p>\n<pre><code>namespace Example.Domain {     #region &lt;&lt; Using &gt;&gt;      using System;     using Incoding.Block.IoC;     using Incoding.CQRS;     using NHibernate.Util;      #endregion      public class InitPeople : ISetUp     {         public void Dispose() { }          public int GetOrder()         {             return 0;         }          public void Execute()         {             \/\/\u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 Dispatcher \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f Query \u0438 Command             var dispatcher = IoCFactory.Instance.TryResolve&lt;IDispatcher&gt;();                          \/\/\u043d\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0438, \u0435\u0441\u043b\u0438 \u0432 \u0431\u0430\u0437\u0435 \u0435\u0441\u0442\u044c \u0445\u043e\u0442\u044f \u0431\u044b \u043e\u0434\u043d\u0430 \u0437\u0430\u043f\u0438\u0441\u044c             if (dispatcher.Query(new GetEntitiesQuery&lt;Human&gt;()).Any())                 return;              \/\/\u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0435\u0439             dispatcher.Push(new AddOrEditHumanCommand                                 {                                         FirstName = &quot;Hellen&quot;,                                         LastName = &quot;Jonson&quot;,                                         BirthDay = Convert.ToDateTime(&quot;06\/05\/1985&quot;),                                         Sex = Sex.Female                                 });             dispatcher.Push(new AddOrEditHumanCommand                                 {                                         FirstName = &quot;John&quot;,                                         LastName = &quot;Carlson&quot;,                                         BirthDay = Convert.ToDateTime(&quot;06\/07\/1985&quot;),                                         Sex = Sex.Male                                 });         }     } }<\/code><\/pre>\n<p>  Back-end \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f CRUD \u0433\u043e\u0442\u043e\u0432\u0430. \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0434\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0438\u0439 \u043a\u043e\u0434.\u00a0\u0422\u0430\u043a\u0436\u0435 \u043a\u0430\u043a \u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u044c\u044e, \u043d\u0430\u0447\u043d\u0435\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0441 \u0447\u0430\u0441\u0442\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f\/\u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0438.\u00a0\u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0444\u0430\u0439\u043b\u00a0<strong>Example.UI -&gt; Views -&gt; Home -&gt; AddOrEditHuman.cshtml.\u00a0<\/strong>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0439 IML-\u043a\u043e\u0434 \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0443\u044e html-\u0444\u043e\u0440\u043c\u0443\u00a0\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 AddOrEditHumanCommand, \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u044f \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 Ajax-\u0437\u0430\u043f\u0440\u043e\u0441.<\/p>\n<h6>AddOrEditHuman.cshtml<\/h6>\n<p>  <\/p>\n<pre><code>@using Example.Domain @using Incoding.MetaLanguageContrib @using Incoding.MvcContrib @model Example.Domain.AddOrEditHumanCommand @*\u0424\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0444\u043e\u0440\u043c\u044b \u0434\u043b\u044f Ajax-\u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u043d\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 AddOrEditHumanCommand*@ @using (Html.When(JqueryBind.Submit)             @*\u041f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0444\u043e\u0440\u043c\u044b \u0447\u0435\u0440\u0435\u0437 Ajax*@             .PreventDefault()             .Submit()             .OnSuccess(dsl =&gt;                            {                                dsl.WithId(&quot;PeopleTable&quot;).Core().Trigger.Incoding();                                dsl.WithId(&quot;dialog&quot;).JqueryUI().Dialog.Close();                            })             .OnError(dsl =&gt; dsl.Self().Core().Form.Validation.Refresh())             .AsHtmlAttributes(new                                   {                                           action = Url.Dispatcher().Push(new AddOrEditHumanCommand()),                                           enctype = &quot;multipart\/form-data&quot;,                                           method = &quot;POST&quot;                                   })             .ToBeginTag(Html, HtmlTag.Form)) {     &lt;div&gt;         @Html.HiddenFor(r =&gt; r.Id)         @Html.ForGroup(r =&gt; r.FirstName).TextBox(control =&gt; control.Label.Name = &quot;First name&quot;)         &lt;br\/&gt;         @Html.ForGroup(r =&gt; r.LastName).TextBox(control =&gt; control.Label.Name = &quot;Last name&quot;)         &lt;br\/&gt;         @Html.ForGroup(r =&gt; r.BirthDay).TextBox(control =&gt; control.Label.Name = &quot;Birthday&quot;)         &lt;br\/&gt;         @Html.ForGroup(r =&gt; r.Sex).DropDown(control =&gt; control.Input.Data = typeof(Sex).ToSelectList())     &lt;\/div&gt;      &lt;div&gt;         &lt;input type=&quot;submit&quot; value=&quot;Save&quot;\/&gt;         @*\u0417\u0430\u043a\u0440\u044b\u0442\u0438\u0435 \u0434\u0438\u0430\u043b\u043e\u0433\u0430*@         @(Html.When(JqueryBind.Click)               .PreventDefault()               .StopPropagation()               .Direct()               .OnSuccess(dsl =&gt; { dsl.WithId(&quot;dialog&quot;).JqueryUI().Dialog.Close(); })               .AsHtmlAttributes()               .ToButton(&quot;Cancel&quot;))     &lt;\/div&gt; }<\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 template, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u043c \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u043e\u0442 GetPeopleQuery. \u0417\u0434\u0435\u0441\u044c \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430 \u0432\u044b\u0432\u043e\u0434 \u0434\u0430\u043d\u043d\u044b\u0445, \u043d\u043e \u0438 \u0437\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0438 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439: \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0444\u0430\u0439\u043b\u00a0<strong>Example.UI -&gt; Views -&gt; Home -&gt; HumanTmpl.cshtml.<\/strong>  <\/p>\n<h6>HumanTmpl.cshtml<\/h6>\n<p>  <\/p>\n<pre><code>@using Example.Domain @using Incoding.MetaLanguageContrib @using Incoding.MvcContrib @{     using (var template = Html.Incoding().Template&lt;GetPeopleQuery.Response&gt;())     {         &lt;table class=&quot;table&quot;&gt;             &lt;thead&gt;             &lt;tr&gt;                 &lt;th&gt;                     First name                 &lt;\/th&gt;                 &lt;th&gt;                     Last name                 &lt;\/th&gt;                 &lt;th&gt;                     Birthday                 &lt;\/th&gt;                 &lt;th&gt;                     Sex                 &lt;\/th&gt;                 &lt;th&gt;&lt;\/th&gt;             &lt;\/tr&gt;             &lt;\/thead&gt;             &lt;tbody&gt;             @using (var each = template.ForEach())             {                 &lt;tr&gt;                     &lt;td&gt;                         @each.For(r =&gt; r.FirstName)                     &lt;\/td&gt;                     &lt;td&gt;                         @each.For(r =&gt; r.LastName)                     &lt;\/td&gt;                     &lt;td&gt;                         @each.For(r =&gt; r.Birthday)                     &lt;\/td&gt;                     &lt;td&gt;                         @each.For(r =&gt; r.Sex)                     &lt;\/td&gt;                     &lt;td&gt;                         @*\u041a\u043d\u043e\u043f\u043a\u0430 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f \u0434\u0438\u0430\u043b\u043e\u0433\u0430 \u0434\u043b\u044f \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f*@                         @(Html.When(JqueryBind.Click)                               .AjaxGet(Url.Dispatcher().Model&lt;AddOrEditHumanCommand&gt;(new                                                                                          {                                                              Id = each.For(r =&gt; r.Id),                                                              FirstName = each.For(r =&gt; r.FirstName),                                                              LastName = each.For(r =&gt; r.LastName),                                                              BirthDay = each.For(r =&gt; r.Birthday),                                                              Sex = each.For(r =&gt; r.Sex)                                                                                          })                                                                 .AsView(&quot;~\/Views\/Home\/AddOrEditHuman.cshtml&quot;))                               .OnSuccess(dsl =&gt; dsl.WithId(&quot;dialog&quot;).Behaviors(inDsl =&gt;                                                                                    {                                                                  inDsl.Core().Insert.Html();                                                                  inDsl.JqueryUI().Dialog.Open(option =&gt;                                                                                                            {                                                                                      option.Resizable = false;                                                                                      option.Title = &quot;Edit human&quot;;                                                                                                            });                                                                                    }))                               .AsHtmlAttributes()                               .ToButton(&quot;Edit&quot;))                          @*\u041a\u043d\u043e\u043f\u043a\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0438*@                         @(Html.When(JqueryBind.Click)                               .AjaxPost(Url.Dispatcher().Push(new DeleteHumanCommand() { HumanId = each.For(r =&gt; r.Id) }))                               .OnSuccess(dsl =&gt; dsl.WithId(&quot;PeopleTable&quot;).Core().Trigger.Incoding())                               .AsHtmlAttributes()                               .ToButton(&quot;Delete&quot;))                     &lt;\/td&gt;                 &lt;\/tr&gt;             }             &lt;\/tbody&gt;         &lt;\/table&gt;     } }<\/code><\/pre>\n<p>  \u0417\u0430\u0434\u0430\u0447\u0430 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f \u0434\u0438\u0430\u043b\u043e\u0433\u043e\u0432\u043e\u0433\u043e \u043e\u043a\u043d\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043a\u043e\u0434, \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0438\u0439 \u0437\u0430 \u044d\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435, \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u0432 <a title=\"Blog: Extensions\" href=\"http:\/\/blog.incframework.com\/ru\/extensions\/\">extension<\/a>.<\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0447\u0430\u0441\u0442\u044c \u2014 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u0440\u0442\u043e\u0432\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438 \u0435\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u043b\u0441\u044f Ajax-\u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u0442 GetPeopleQuery \u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0438\u0445 \u0447\u0435\u0440\u0435\u0437 HumanTmpl: \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u0435 \u0444\u0430\u0439\u043b\u00a0<strong>Example.UI -&gt; Views -&gt; Home -&gt; Index.cshtml\u00a0<\/strong>\u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u043b \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u043c\u0443 \u043d\u0438\u0436\u0435 \u043a\u043e\u0434\u0443.  <\/p>\n<h6>Index.cshtml<\/h6>\n<p>  <\/p>\n<pre><code>@using Example.Domain @using Incoding.MetaLanguageContrib @using Incoding.MvcContrib @{     Layout = &quot;~\/Views\/Shared\/_Layout.cshtml&quot;; } &lt;div id=&quot;dialog&quot;&gt;&lt;\/div&gt;  @*\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u0438\u0437 GetPeopleQuery, \u0447\u0435\u0440\u0435\u0437 HumanTmpl*@ @(Html.When(JqueryBind.InitIncoding)       .AjaxGet(Url.Dispatcher().Query(new GetPeopleQuery()).AsJson())       .OnSuccess(dsl =&gt; dsl.Self().Core().Insert.WithTemplateByUrl(Url.Dispatcher().AsView(&quot;~\/Views\/Home\/HumanTmpl.cshtml&quot;)).Html())       .AsHtmlAttributes(new { id = &quot;PeopleTable&quot; })       .ToDiv()) @*\u041a\u043d\u043e\u043f\u043a\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438*@ @(Html.When(JqueryBind.Click)       .AjaxGet(Url.Dispatcher().AsView(&quot;~\/Views\/Home\/AddOrEditHuman.cshtml&quot;))       .OnSuccess(dsl =&gt; dsl.WithId(&quot;dialog&quot;).Behaviors(inDsl =&gt;                                                            {                                                                inDsl.Core().Insert.Html();                                                                inDsl.JqueryUI().Dialog.Open(option =&gt;                                                                                                 {                                       option.Resizable = false;                                       option.Title = &quot;Add human&quot;;                                                                                                 });                                                            }))       .AsHtmlAttributes()       .ToButton(&quot;Add new human&quot;))<\/code><\/pre>\n<p>  \u0412 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f \u0432\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0444\u043e\u0440\u043c \u2014 \u043e\u0434\u043d\u0430 \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u0447\u0430\u0441\u0442\u044b\u0445 \u0437\u0430\u0434\u0430\u0447. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044e \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u0444\u043e\u0440\u043c\u0443 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f\/\u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 Human.\u00a0\u041f\u0435\u0440\u0432\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u2014 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430.<strong>\u00a0<\/strong>\u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u0432 AddOrEditHumanCommand \u043a\u0430\u043a nested class:<\/p>\n<pre><code>#region Nested Classes  public class Validator : AbstractValidator {     #region Constructors      public Validator()     {         RuleFor(r =&gt; r.FirstName).NotEmpty();         RuleFor(r =&gt; r.LastName).NotEmpty();     }      #endregion }  #endregion<\/code><\/pre>\n<p>  \u041d\u0430 \u0444\u043e\u0440\u043c\u0435 AddOrEditHuman.cshtml \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u0432\u0438\u0434\u0430:<\/p>\n<pre><code>@Html.ForGroup()<\/code><\/pre>\n<p>  \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c<\/p>\n<pre><code>@Html.ValidationMessageFor()<\/code><\/pre>\n<p>  \u0434\u043b\u044f \u043f\u043e\u043b\u0435\u0439 \u2014 <a title=\"\u0421\u043e\u0432\u0435\u0442\u044b \u0438 \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0438\" href=\"http:\/\/blog.incframework.com\/ru\/tips-and-trick\/\">ForGroup()<\/a> \u0441\u0434\u0435\u043b\u0430\u0435\u0442 \u044d\u0442\u043e \u0437\u0430 \u043d\u0430\u0441.<br \/>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043c\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u043a\u043e\u0434 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 CRUD-\u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0439 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u0411\u0414.<\/p>\n<h1>\u0427\u0430\u0441\u0442\u044c 4. Specifications \u2014 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445.<\/h1>\n<p>  \u0415\u0449\u0435 \u043e\u0434\u043d\u0430 \u0438\u0437 \u0437\u0430\u0434\u0430\u0447, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0447\u0430\u0441\u0442\u043e \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u044e\u0442\u0441\u044f \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u2014 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.\u00a0\u0412 Incoding Framework \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043a\u043e\u0434\u0430 \u0438 \u0441\u043e\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0430 \u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u044f\u0446\u0438\u0438 \u0434\u043b\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c\u044b\u0445 \u0432 Query \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f WhereSpecifications.\u00a0\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c\u044b\u0445 \u0432 GetPeopleQuery \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e FirstName \u0438 LastName.\u00a0\u0412 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0434\u0432\u0430 \u0444\u0430\u0439\u043b\u0430 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0439\u00a0<strong>Example.Domain -&gt; Specifications -&gt; HumanByFirstNameWhereSpec.cs\u00a0<\/strong>\u0438\u00a0<strong>Example.UI -&gt; Specifications -&gt; HumanByLastNameWhereSpec.cs<\/strong><\/p>\n<h6>HumanByFirstNameWhereSpec.cs<\/h6>\n<p>  <\/p>\n<pre><code>namespace Example.Domain {     #region &lt;&lt; Using &gt;&gt;      using System;     using System.Linq.Exsource ssions;     using Incoding;      #endregion      public class HumanByFirstNameWhereSpec : Specification     {         #region Fields          readonly string firstName;          #endregion          #region Constructors          public HumanByFirstNameWhereSpec(string firstName)         {             this.firstName = firstName;         }          #endregion          public override Exsource ssion&lt;Func&lt;Human, bool&gt;&gt; IsSatisfiedBy()         {             if (string.IsNullOrEmpty(this.firstName))                 return null;              return human =&gt; human.FirstName.ToLower().Contains(this.firstName.ToLower());         }     } }<\/code><\/pre>\n<p>  <\/p>\n<h6>HumanByLastNameWhereSpec.cs<\/h6>\n<p>  <\/p>\n<pre><code>namespace Example.Domain {     #region &lt;&lt; Using &gt;&gt;      using System;     using System.Linq.Exsource ssions;     using Incoding;      #endregion      public class HumanByLastNameWhereSpec : Specification     {         #region Fields          readonly string lastName;          #endregion          #region Constructors          public HumanByLastNameWhereSpec(string lastName)         {             this.lastName = lastName.ToLower();         }          #endregion          public override Exsource ssion&lt;Func&lt;Human, bool&gt;&gt; IsSatisfiedBy()         {             if (string.IsNullOrEmpty(this.lastName))                 return null;              return human =&gt; human.LastName.ToLower().Contains(this.lastName);         }     } }<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 GetPeopleQuery. \u041f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0441\u0432\u044f\u0437\u043e\u043a .Or()\/.And() \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u044b\u0435 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0442\u044c \u0432 \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0435, \u0447\u0442\u043e \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043c\u043d\u043e\u0433\u043e\u043a\u0440\u0430\u0442\u043d\u043e \u0438 \u043f\u0440\u0438 \u0438\u0445 \u043f\u043e\u043c\u043e\u0449\u0438 \u0442\u043e\u043d\u043a\u043e \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0444\u0438\u043b\u044c\u0442\u0440\u044b \u0434\u0430\u043d\u043d\u044b\u0445 (\u0432 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0441\u0432\u044f\u0437\u043a\u0443 .Or()).  <\/p>\n<h6>GetPeopleQuery.cs<\/h6>\n<p>  <\/p>\n<pre><code class=\"cs\">namespace Example.Domain {     #region &lt;&lt; Using &gt;&gt;      using System.Collections.Generic;     using System.Linq;     using Incoding.CQRS;     using Incoding.Extensions;      #endregion      public class GetPeopleQuery : QueryBase&lt;List&lt;GetPeopleQuery.Response&gt;&gt;     {         #region Properties          public string Keyword { get; set; }          #endregion          #region Nested Classes          public class Response         {             #region Properties              public string Birthday { get; set; }              public string FirstName { get; set; }              public string Id { get; set; }              public string LastName { get; set; }              public string Sex { get; set; }              #endregion         }          #endregion          protected override List&lt;Response&gt; ExecuteResult()         {             return Repository.Query(whereSpecification:new HumanByFirstNameWhereSpec(Keyword)                                                       .Or(new HumanByLastNameWhereSpec(Keyword)))                              .Select(human =&gt; new Response                                                   {                                                        Id = human.Id,                                                        Birthday = human.Birthday.ToShortDateString(),                                                        FirstName = human.FirstName,                                                        LastName = human.LastName,                                                        Sex = human.Sex.ToString()                                                   })                              .ToList();         }     } } <\/code><\/pre>\n<p>  \u0418 \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c Index.cshtml, \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443, \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u043f\u0440\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u043f\u043e\u043b\u0435 Keyword \u0434\u043b\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<h6>Index.cshtml<\/h6>\n<p>  <\/p>\n<pre><code>@using Example.Domain @using Incoding.MetaLanguageContrib @using Incoding.MvcContrib @{     Layout = &quot;~\/Views\/Shared\/_Layout.cshtml&quot;; } &lt;div id=&quot;dialog&quot;&gt;&lt;\/div&gt;  @*\u041f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043a\u043d\u043e\u043f\u043a\u0438 Find \u0438\u043d\u0438\u0446\u0438\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u0435 InitIncoding \u0438 PeopleTable \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 GetPeopleQuery \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c Keyword*@ &lt;div&gt;     &lt;input type=&quot;text&quot; id=&quot;Keyword&quot;\/&gt;     @(Html.When(JqueryBind.Click)           .Direct()           .OnSuccess(dsl =&gt; dsl.WithId(&quot;PeopleTable&quot;).Core().Trigger.Incoding())           .AsHtmlAttributes()           .ToButton(&quot;Find&quot;)) &lt;\/div&gt;  @(Html.When(JqueryBind.InitIncoding)       .AjaxGet(Url.Dispatcher().Query(new GetPeopleQuery { Keyword = Selector.Jquery.Id(&quot;Keyword&quot;) }).AsJson())       .OnSuccess(dsl =&gt; dsl.Self().Core().Insert.WithTemplateByUrl(Url.Dispatcher().AsView(&quot;~\/Views\/Home\/HumanTmpl.cshtml&quot;)).Html())       .AsHtmlAttributes(new { id = &quot;PeopleTable&quot; })       .ToDiv())  @(Html.When(JqueryBind.Click)       .AjaxGet(Url.Dispatcher().AsView(&quot;~\/Views\/Home\/AddOrEditHuman.cshtml&quot;))       .OnSuccess(dsl =&gt; dsl.WithId(&quot;dialog&quot;).Behaviors(inDsl =&gt;                                                            {                                                                inDsl.Core().Insert.Html();                                                                inDsl.JqueryUI().Dialog.Open(option =&gt;                                                                                                 {                                                                   option.Resizable = false;                                                                   option.Title = &quot;Add human&quot;;                                                                                                 });                                                            }))       .AsHtmlAttributes()       .ToButton(&quot;Add new human&quot;))<\/code><\/pre>\n<p>  <\/p>\n<h1>\u0427\u0430\u0441\u0442\u044c 5. \u042e\u043d\u0438\u0442-\u0442\u0435\u0441\u0442\u044b.<\/h1>\n<p>  \u041f\u043e\u043a\u0440\u043e\u0435\u043c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u0442\u0435\u0441\u0442\u0430\u043c\u0438.\u00a0\u041f\u0435\u0440\u0432\u044b\u0439 \u0442\u0435\u0441\u0442 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u043c\u0430\u043f\u043f\u0438\u043d\u0433\u0430 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 Human. \u0424\u0430\u0439\u043b When_save_Human.cs \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u043f\u0430\u043f\u043a\u0443 Persisteces \u043f\u0440\u043e\u0435\u043a\u0442\u0430 UnitTests.<\/p>\n<h6><b>When_save_Human.cs<\/b><\/h6>\n<p>  <\/p>\n<pre><code>namespace Example.UnitTests.Persistences {     #region &lt;&lt; Using &gt;&gt;      using Example.Domain;     using Incoding.MSpecContrib;     using Machine.Specifications;      #endregion      [Subject(typeof(Human))]     public class When_save_Human : SpecWithPersistenceSpecification     {         #region Fields          It should_be_verify = () =&gt; persistenceSpecification.VerifyMappingAndSchema();          #endregion     } } <\/code><\/pre>\n<p>  \u0414\u0430\u043d\u043d\u044b\u0439 \u0442\u0435\u0441\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 (Example_test): \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043b\u0430\u0441\u0441\u0430 Human \u0441 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u043c\u0438 \u043f\u043e\u043b\u044f\u043c\u0438, \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u0432 \u0431\u0430\u0437\u0443, \u0430 \u0437\u0430\u0442\u0435\u043c \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u0442\u0441\u044f \u0438 \u0441\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u043c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u043c.<br \/>  \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0442\u0435\u0441\u0442\u044b \u0434\u043b\u044f WhereSpecifications \u0432 \u043f\u0430\u043f\u043a\u0443 Specifications.<\/p>\n<h6><strong>When_human_by_first_name.cs<\/strong><\/h6>\n<p>  <\/p>\n<pre><code>namespace Example.UnitTests.Specifications {     #region &lt;&lt; Using &gt;&gt;      using System;     using System.Collections.Generic;     using System.Linq;     using Example.Domain;     using Incoding.MSpecContrib;     using Machine.Specifications;      #endregion      [Subject(typeof(HumanByFirstNameWhereSpec))]     public class When_human_by_first_name     {         #region Fields          Establish establish = () =&gt;                                   {           Func&lt;string, Human&gt; createEntity = (firstName) =&gt;                Pleasure.MockStrictAsObject(mock =&gt; mock.SetupGet(r =&gt; r.FirstName).Returns(firstName));            fakeCollection = Pleasure.ToQueryable(createEntity(Pleasure.Generator.TheSameString()),                                                     createEntity(Pleasure.Generator.String()));                                   };          Because of = () =&gt;                          {           filterCollection = fakeCollection              .Where(new HumanByFirstNameWhereSpec(Pleasure.Generator.TheSameString()).IsSatisfiedBy())              .ToList();                          };          It should_be_filter = () =&gt;                                   {                                       filterCollection.Count.ShouldEqual(1);                                       filterCollection[0].FirstName.ShouldBeTheSameString();                                   };          #endregion          #region Establish value          static IQueryable fakeCollection;          static List filterCollection;          #endregion     } } <\/code><\/pre>\n<p>  <\/p>\n<h6><strong>When_human_by_last_name.cs<\/strong><\/h6>\n<p>  <\/p>\n<pre><code>namespace Example.UnitTests.Specifications {     #region &lt;&lt; Using &gt;&gt;      using System;     using System.Collections.Generic;     using System.Linq;     using Example.Domain;     using Incoding.MSpecContrib;     using Machine.Specifications;      #endregion      [Subject(typeof(HumanByLastNameWhereSpec))]     public class When_human_by_last_name     {         #region Fields          Establish establish = () =&gt;                                   {           Func&lt;string, Human&gt; createEntity = (lastName) =&gt;            Pleasure.MockStrictAsObject(mock =&gt;mock.SetupGet(r =&gt; r.LastName).Returns(lastName));            fakeCollection = Pleasure.ToQueryable(createEntity(Pleasure.Generator.TheSameString()),                                                createEntity(Pleasure.Generator.String()));                                   };          Because of = () =&gt;                          {            filterCollection = fakeCollection             .Where(new HumanByLastNameWhereSpec(Pleasure.Generator.TheSameString()).IsSatisfiedBy())             .ToList();                          };          It should_be_filter = () =&gt;                                   {                                       filterCollection.Count.ShouldEqual(1);                                       filterCollection[0].LastName.ShouldBeTheSameString();                                   };          #endregion          #region Establish value          static IQueryable fakeCollection;          static List filterCollection;          #endregion     } } <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0442\u0435\u0441\u0442\u044b \u0434\u043b\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 (\u043f\u0430\u043f\u043a\u0430 Operations), \u043f\u0440\u0438\u0447\u0435\u043c \u0434\u043b\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0434\u0432\u0430 \u0442\u0435\u0441\u0442\u0430: \u043e\u0434\u0438\u043d \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0439 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u0438 \u0432\u0442\u043e\u0440\u043e\u0439 \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438.<\/p>\n<h6><strong>When_get_people_query.cs<\/strong><\/h6>\n<p>  <\/p>\n<pre><code>namespace Example.UnitTests.Operations {     #region &lt;&lt; Using &gt;&gt;      using System.Collections.Generic;     using Example.Domain;     using Incoding.Extensions;     using Incoding.MSpecContrib;     using Machine.Specifications;      #endregion      [Subject(typeof(GetPeopleQuery))]     public class When_get_people     {         #region Fields          Establish establish = () =&gt;                                   {                             var query = Pleasure.Generator.Invent&lt;GetPeopleQuery&gt;();                             \/\/Create entity for test with auto-generate                             human = Pleasure.Generator.Invent&lt;Human&gt;();                              expected = new List&lt;GetPeopleQuery.Response&gt;();                                  mockQuery = MockQuery&lt;GetPeopleQuery, List&lt;GetPeopleQuery.Response&gt;&gt;                              .When(query)                               \/\/&quot;Stub&quot; on query to repository                              .StubQuery(whereSpecification:                                               new HumanByFirstNameWhereSpec(query.Keyword)                                                   .Or(new HumanByLastNameWhereSpec(query.Keyword)),                                        entities: human);                                   };          Because of = () =&gt; mockQuery.Original.Execute();                  \/\/ Compare result          It should_be_result = () =&gt; mockQuery .ShouldBeIsResult(list =&gt; list.ShouldEqualWeakEach(new List&lt;Human&gt;() { human }, (dsl, i) =&gt;                 dsl.ForwardToValue(r =&gt; r.Birthday, human.Birthday.ToShortDateString())                   .ForwardToValue(r =&gt; r.Sex, human.Sex.ToString())));          #endregion          #region Establish value          static MockMessage&lt;GetPeopleQuery, List&lt;GetPeopleQuery.Response&gt;&gt; mockQuery;          static List&lt;GetPeopleQuery.Response&gt; expected;          static Human human;          #endregion     } } <\/code><\/pre>\n<h6><strong>When_add_human.cs<\/strong><\/h6>\n<p>  <\/p>\n<pre><code>namespace Example.UnitTests.Operations {     #region &lt;&lt; Using &gt;&gt;      using Example.Domain;     using Incoding.MSpecContrib;     using Machine.Specifications;      #endregion      [Subject(typeof(AddOrEditHumanCommand))]     public class When_add_human     {         #region Fields          Establish establish = () =&gt;                                   {                                       var command = Pleasure.Generator.Invent&lt;AddOrEditHumanCommand&gt;();                                        mockCommand = MockCommand&lt;AddOrEditHumanCommand&gt;                                               .When(command)                                               \/\/&quot;Stub&quot; on repository                                               .StubGetById&lt;Human&gt;(command.Id, null);                                   };          Because of = () =&gt; mockCommand.Original.Execute();          It should_be_saved = () =&gt; mockCommand             .ShouldBeSaveOrUpdate&lt;Human&gt;(human =&gt; human.ShouldEqualWeak(mockCommand.Original));          #endregion          #region Establish value          static MockMessage&lt;AddOrEditHumanCommand, object&gt; mockCommand;          #endregion     } } <\/code><\/pre>\n<p>  <\/p>\n<h6><strong>When_edit_human.cs<\/strong><\/h6>\n<p>  <\/p>\n<pre><code>namespace Example.UnitTests.Operations {     #region &lt;&lt; Using &gt;&gt;      using Example.Domain;     using Incoding.MSpecContrib;     using Machine.Specifications;      #endregion      [Subject(typeof(AddOrEditHumanCommand))]     public class When_edit_human     {         #region Fields          Establish establish = () =&gt;                                   {                                       var command = Pleasure.Generator.Invent&lt;AddOrEditHumanCommand&gt;();                                        human = Pleasure.Generator.Invent&lt;Human&gt;();                                        mockCommand = MockCommand&lt;AddOrEditHumanCommand&gt;                                               .When(command)                                               \/\/&quot;Stub&quot; on repository                                               .StubGetById(command.Id, human);                                   };          Because of = () =&gt; mockCommand.Original.Execute();          It should_be_saved = () =&gt; mockCommand                     .ShouldBeSaveOrUpdate&lt;Human&gt;(human =&gt; human.ShouldEqualWeak(mockCommand.Original));          #endregion          #region Establish value          static MockMessage&lt;AddOrEditHumanCommand, object&gt; mockCommand;          static Human human;          #endregion     } } <\/code><\/pre>\n<p>  <\/p>\n<h1>\u0421\u043f\u0438\u0441\u043e\u043a \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u043e\u0432 \u0434\u043b\u044f \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f<\/h1>\n<p>  <\/p>\n<ol>\n<li><a title=\"Blog: CQRS\" href=\"http:\/\/habrahabr.ru\/post\/211206\/\">CQRS<\/a> \u2014 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u0438<\/li>\n<li><a title=\"Blog: MVD\" href=\"http:\/\/habrahabr.ru\/post\/221585\/\">MVD<\/a> \u2014 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430 Model View Dispatcher<\/li>\n<li><a title=\"Blog: IML\" href=\"http:\/\/habrahabr.ru\/post\/209734\/\">IML introduction<\/a><\/li>\n<li><a title=\"Blog: IML\" href=\"http:\/\/habrahabr.ru\/post\/214963\/\">IML TODO MVC<\/a><\/li>\n<\/ol>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/266609\/\"> http:\/\/habrahabr.ru\/post\/266609\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>       <a href=\"http:\/\/incframework.com\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/001\/77f\/d8e\/00177fd8e91cac6509c2a30562a0dd50.png\" alt=\"IncFramework-logo\" width=\"920\" height=\"398\"\/><\/a><br \/>  <em><strong>disclaimer:<\/strong>\u00a0\u0434\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0448\u0430\u0433\u043e\u0432\u044b\u043c \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c\u0438\u00a0<strong>Incoding Framework<\/strong>. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0443 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043a\u0440\u044b\u0442\u043e\u0435 \u044e\u043d\u0438\u0442-\u0442\u0435\u0441\u0442\u0430\u043c\u0438 <a href=\"https:\/\/github.com\/IncodingSoftware\/get-started\">\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/a>, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0435\u0435 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u0411\u0414 (CRUD + data filters). \u041e Incoding framework \u0440\u0430\u043d\u0435\u0435 \u0443\u0436\u0435 \u0431\u044b\u043b\u0438 \u0441\u0442\u0430\u0442\u044c\u0438 \u043d\u0430 habrahabr, \u043d\u043e \u0432 \u043d\u0438\u0445 \u0440\u0430\u0441\u043a\u0440\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0447\u0430\u0441\u0442\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430.<\/em><\/p>\n<h1>\u0427\u0430\u0441\u0442\u044c 0. \u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435.<\/h1>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043c \u043a\u0440\u0430\u0442\u043a\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u00a0\u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430<strong>.\u00a0<\/strong><strong>Incoding<\/strong> <strong>Framework<\/strong> \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0442\u0440\u0435\u0445 \u043f\u0430\u043a\u0435\u0442\u043e\u0432: Incoding framework \u2013 back-end \u043f\u0440\u043e\u0435\u043a\u0442\u0430, Incoding Meta Language \u2013 front-end \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0438 Incoding tests helpers \u2013 \u044e\u043d\u0438\u0442-\u0442\u0435\u0441\u0442\u044b \u0434\u043b\u044f back-end\u2019\u0430. \u042d\u0442\u0438 \u043f\u0430\u043a\u0435\u0442\u044b \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u0434\u0440\u0443\u0433 \u043e\u0442 \u0434\u0440\u0443\u0433\u0430, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0432 \u043f\u0440\u043e\u0435\u043a\u0442 \u0447\u0430\u0441\u0442\u044f\u043c\u0438: \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0443\u044e \u0438\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u0443\u044e \u0447\u0430\u0441\u0442\u044c (\u0442\u0435\u0441\u0442\u044b \u043e\u0447\u0435\u043d\u044c \u0441\u0438\u043b\u044c\u043d\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u044b \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u044c\u044e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0437\u0438\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435).<br \/>  \u0412 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u043d\u0430\u00a0<strong>Incoding Framework<\/strong>,<strong>\u00a0<\/strong>\u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u043e\u0439 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <a title=\"Martin Fowler: CQRS\" href=\"http:\/\/martinfowler.com\/bliki\/CQRS.html\">CQRS<\/a>. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <a title=\"Habrahabr: Incoding rapid development framework\" href=\"http:\/\/habrahabr.ru\/post\/209734\/\">Incoding Meta Language<\/a>. \u0412 \u0446\u0435\u043b\u043e\u043c\u00a0<strong>Incoding Framework\u00a0<\/strong>\u043f\u043e\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u0432\u0435\u0441\u044c \u0446\u0438\u043a\u043b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<br \/>  \u0422\u0438\u043f\u0438\u0447\u043d\u044b\u0439 solution, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e\u00a0<strong>Incoding Framework,\u00a0<\/strong>\u0438\u043c\u0435\u0435\u0442 3 \u043f\u0440\u043e\u0435\u043a\u0442\u0430:<\/p>\n<ol>\n<li><b>Domain (<em>class library) <\/em><\/b><em> \u2014 <\/em>\u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0443 \u0438 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445.<\/li>\n<li><b>UI (<em>ASP.NET MVC project<\/em>)<i>\u00a0<\/i><\/b><i>&#8212;\u00a0<\/i>\u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0430\u044f \u0447\u0430\u0441\u0442\u044c, \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u043d\u0430\u00a0ASP.NET MVC.<\/li>\n<li><strong>UnitTests (<em>class library<\/em>)\u00a0<\/strong> \u2014 \u044e\u043d\u0438\u0442-\u0442\u0435\u0441\u0442\u044b \u0434\u043b\u044f Domain.<\/li>\n<\/ol>\n<p>  <\/p>\n<h3>Domain<\/h3>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043f\u0430\u043a\u0435\u0442\u0430\u00a0<a title=\"Nuget: Incoding framework\" href=\"https:\/\/www.nuget.org\/packages\/Incoding.Framework\/\">Incoding framework<\/a>\u00a0\u0447\u0435\u0440\u0435\u0437 Nuget \u0432 \u043f\u0440\u043e\u0435\u043a\u0442 \u043f\u043e\u043c\u0438\u043c\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 dll \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0444\u0430\u0439\u043b Bootstrapper.cs. \u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u044d\u0442\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u2014 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f: \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f IoC, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430\u00a0\u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a Ajax-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0438 \u043f\u0440. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 IoC framework \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f <a title=\"StructureMap docs\" href=\"http:\/\/docs.structuremap.net\/\">StructureMap<\/a>, \u043e\u0434\u043d\u0430\u043a\u043e \u0435\u0441\u0442\u044c \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440 \u0434\u043b\u044f Ninject, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u0432\u043e\u0438\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439.<\/p>\n<pre><code class=\"cs\">namespace Example.Domain {     #region &lt;&lt; Using &gt;&gt;      using System;     using System.Configuration;     using System.IO;     using System.Linq;     using System.Web.Mvc;     using FluentNHibernate.Cfg;     using FluentNHibernate.Cfg.Db;     using FluentValidation;     using FluentValidation.Mvc;     using Incoding.Block.IoC;     using Incoding.Block.Logging;     using Incoding.CQRS;     using Incoding.Data;     using Incoding.EventBroker;     using Incoding.Extensions;     using Incoding.MvcContrib;     using NHibernate.Tool.hbm2ddl;     using StructureMap.Graph;      #endregion      public static class Bootstrapper     {         public static void Start()         {             \/\/Initialize LoggingFactory             LoggingFactory.Instance.Initialize(logging =&gt;                 {  string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, &quot;Log&quot;);  logging.WithPolicy(policy =&gt; policy.For(LogType.Debug).Use(FileLogger.WithAtOnceReplace(path,                                           () =&gt; &quot;Debug_{0}.txt&quot;.F(DateTime.Now.ToString(&quot;yyyyMMdd&quot;)))));                 });              \/\/Initialize IoCFactory             IoCFactory.Instance.Initialize(init =&gt;                   init.WithProvider(new StructureMapIoCProvider(registry =&gt;                 {                 registry.For&lt;IDispatcher&gt;().Use&lt;DefaultDispatcher&gt;();                 registry.For&lt;IEventBroker&gt;().Use&lt;DefaultEventBroker&gt;();                 registry.For&lt;ITemplateFactory&gt;().Singleton().Use&lt;TemplateHandlebarsFactory&gt;();                  \/\/Configure FluentlyNhibernate                 var configure = Fluently                        .Configure()                        .Database(MsSqlConfiguration.MsSql2008                 .ConnectionString(ConfigurationManager.ConnectionStrings[&quot;Example&quot;].ConnectionString))                        .Mappings(configuration =&gt; configuration.FluentMappings                                                      .AddFromAssembly(typeof(Bootstrapper).Assembly))                        .ExposeConfiguration(cfg =&gt; new SchemaUpdate(cfg).Execute(false, true))                        .CurrentSessionContext&lt;NhibernateSessionContext&gt;();                  registry.For&lt;INhibernateSessionFactory&gt;()                         .Singleton()                         .Use(() =&gt; new NhibernateSessionFactory(configure));                 registry.For&lt;IUnitOfWorkFactory&gt;().Use&lt;NhibernateUnitOfWorkFactory&gt;();                 registry.For&lt;IRepository&gt;().Use&lt;NhibernateRepository&gt;();                  \/\/Scan currenlty Assembly and registrations all Validators and Event Subscribers                 registry.Scan(r =&gt;                                     {                                 r.TheCallingAssembly();                                 r.WithDefaultConventions();                                 r.ConnectImplementationsToTypesClosing(typeof(AbstractValidator&lt;&gt;));                                 r.ConnectImplementationsToTypesClosing(typeof(IEventSubscriber&lt;&gt;));                                 r.AddAllTypesOf&lt;ISetUp&gt;();                                     });                 })));              ModelValidatorProviders.Providers                           .Add(new FluentValidationModelValidatorProvider(new IncValidatorFactory()));             FluentValidationModelValidatorProvider.Configure();              \/\/Execute all SetUp             foreach (var setUp in IoCFactory.Instance.ResolveAll&lt;ISetUp&gt;().OrderBy(r =&gt; r.GetOrder()))             {                 setUp.Execute();             }              var ajaxDef = JqueryAjaxOptions.Default;             ajaxDef.Cache = false; \/\/Disable Ajax cache         }     } } <\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u0432\u00a0<strong>Domain\u00a0<\/strong>\u0434\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b (Command) \u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u044b (Query), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 \u043b\u0438\u0431\u043e \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0434\u0440\u0443\u0433\u0438\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u043e\u0439 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<h3>UI<\/h3>\n<p>  \u041f\u0430\u043a\u0435\u0442 <a title=\"Nuget: Incoding Meta Language\" href=\"https:\/\/www.nuget.org\/packages\/Incoding.MetaLanguage\/\">Incoding Meta Language<\/a>\u00a0\u043f\u0440\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 dll, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0444\u0430\u0439\u043b\u044b IncodingStart.cs \u0438 DispatcherController.cs (\u0447\u0430\u0441\u0442\u044c <a title=\"Habrahabr: Model View Dispatcher (cqrs over mvc)\" href=\"http:\/\/habrahabr.ru\/post\/221585\/\">MVD<\/a>) \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 Domain.<\/p>\n<pre><code>public static class IncodingStart {     public static void source Start()     {         Bootstrapper.Start();         new DispatcherController(); \/\/ init routes     } }<\/code><\/pre>\n<p>  <\/p>\n<pre><code>public class DispatcherController : DispatcherControllerBase {     #region Constructors      public DispatcherController()             : base(typeof(Bootstrapper).Assembly) { }      #endregion }<\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0432 <strong>UI<\/strong>\u00a0\u0434\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0430\u044f \u043b\u043e\u0433\u0438\u043a\u0430 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c\u00a0<a title=\"Habrahabr: Incoding rapid development framework\" href=\"http:\/\/habrahabr.ru\/post\/209734\/\">IML<\/a>.<\/p>\n<h3>UnitTests<\/h3>\n<p>  \u041f\u0440\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 <a title=\"Nuget: Incoding tests helpers\" href=\"https:\/\/www.nuget.org\/packages\/Incoding.MSpecContrib\/\">Incoding tests helpers<\/a>\u00a0\u0432 \u043f\u0440\u043e\u0435\u043a\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0444\u0430\u0439\u043b MSpecAssemblyContext.cs, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f\u00a0connection \u043a \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<pre><code>public class MSpecAssemblyContext : IAssemblyContext {     #region IAssemblyContext Members      public void OnAssemblyStart()     {         \/\/\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0411\u0414         var configure = Fluently                 .Configure()                 .Database(MsSqlConfiguration.MsSql2008                          .ConnectionString(ConfigurationManager.ConnectionStrings[&quot;Example_Test&quot;].ConnectionString)                                             .ShowSql())                 .Mappings(configuration =&gt; configuration.FluentMappings.AddFromAssembly(typeof(Bootstrapper).Assembly));          PleasureForData.StartNhibernate(configure, true);     }      public void OnAssemblyComplete() { }      #endregion }<\/code><\/pre>\n<p>  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-265680","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/265680","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=265680"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/265680\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=265680"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=265680"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=265680"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}