``

New Approach

to the development

of Web-applications and Services for mobile devices.

Version: 1.329.03.2015 Get started

Feedback

Пожалуйста, укажите Ваши Имя и E-mail, чтобы мы могли с Вами связаться. Дополнительную информацию Вы можете указать в графе “Комментарий”.

Thanks for you feedback !!

What is Incoding Framework?

Incoding Framework is the opensource library for rapid development web/desktop-applications. Incoding Framework can be used for resolving different kinds of issues - it supports all development life cycle. Incoding Framework helps make more things with less code:

About CQRS

The one of the development issues for business applications is "connectedness" of components, which is critical in complex scenarios, so as a base server architecture was chosen CQRS, which allows to achieve a high level of decomposition. The main feature of the realization Incoding Framework is that it comprises a set of base classes and interfaces that cover most popular development scenarios.

Click on green selection to see more info about element...

Command – use to work with the database (with opening a transaction), or for other tasks (without opening a transaction)
public classs AddCustomerCommand : CommandBase { public string First { get; set; } public string Last { get; set; } public string Mark { get; set; } public override void Execute() { Repository.Save(new Customer { First = First, Last = Last, Mark = Mark }); } }
* Command - the first of two atomic parts CQRS, responsible for Write-functional business logic of the application. With Command you can perform any database operations (preservation of the Customer entity example), or perform any other non-database operation. All Commands inherited from the base class CommandBase.
Query – get data from the database (open read-uncommited-transaction) or from external data sources
public classs GetCustomersQuery : QueryBase<List<GetCustomersQuery.Response>> { public string Search { get; set; } public classs Response { public string FullName { get; set; } public string Id { get; set; } public string Date { get; set; } } protected override List<Response> ExecuteResult() { return Repository.Query(whereSpecification: new CustomerBySearchWhereSpec(Search)) .ToList() .Select(r => new Response { Id = r.Id.ToString(), FullName = r.First + r.Last, Date = r.CreateDt.ToShortDateString() }) .ToList(); } }
* Query is second of the two atomic parts CQRS, which is responsible for Read-functional business logic of the application. With Query you can retrieve data from any database resource whether it (getting filtered through the fields First and Last collection of Customer entities example), or any other data resource. All Queries inherited from the base class QueryBase.
Dispatcher – carry out your Commands and Queries with keeping UnitOfWork pattern
public classs CustomerController : IncControllerBase { public ActionResult Fetch(GetCustomersQuery query) { return IncJson(query); } public ActionResult Add(AddCustomerCommand input) { return TryPush(input); } }
* Dispatcher is a key element in the CQRS, which performs the Command and Query in a single transaction, realizing the pattern Unit Of Work, and also allows you to take full advantage of AOP without additional plug-ins or third-party libraries.
Read more:

Some things about IML

The dynamic part of the JavaScript language complicates the support of applications, and requires from developer always consider all the subtleties of dynamic typing (null, undefined, 'undefined', this). IML is a meta-language that allows you to create custom scripts without writing any JavaScript-code - you can build your client-side applications using the syntax of C#.

IML Action – create your own event handlers for standard browser events
@model AddCustomerCommand @(Html.When(JqueryBind.Click) .Direct() .OnSuccess(dsl => dsl.WithId("customers").Core().Trigger.Incoding()) .AsHtmlAttributes() .ToButton("Refresh")) @(Html.When(JqueryBind.InitIncoding) .AjaxGet(Url.Dispatcher().Query(new GetCustomersQuery()).AsJson()) .OnSuccess(dsl => { string urlToTmpl = Url.Dispatcher().AsView("~/Views/Customer/Table_Tmpl.cshtml"); dsl.Self().Core().Insert.WithTemplateByUrl(urlToTmpl).Html(); }) .AsHtmlAttributes() .ToDiv()) @Html.TextBoxFor(r => r.First) @Html.TextBoxFor(r => r.Last) @Html.TextBoxFor(r => r.Mark) @(Html.When(JqueryBind.Click) .AjaxPost(Url.Dispatcher().Push(new AddCustomerCommand { First = Html.Selector().Name(r => r.First), Last = Html.Selector().Name(r => r.Last) })) .OnSuccess(dsl => dsl.WithId("customers").Core().Trigger.Incoding()) .AsHtmlAttributes() .ToLink("Add"))
* IML allows you to create your own event handlers of the browser events (Click, PressKey, FocusIn, OnLoad == InitIncoding etc.) without writing any JavaScript-code. During event processing you can perform Ajax-requests to the server (Ajax (), AjaxPost (), AjaxGet ()). If the request does not need to, you can use the direct processing of events Direct (). In all of these cases, you can also cancel the browser default event handling (PreventDefault ()) and / or to stop the further spread of the event (StopPropagation ()).
Read more:

Why MVD

When you work with CQRS all actions of business logic are divided into commands and queries. Code of applications has become much easier, however, the number of trivial actions to execute commands or queries has increased. In Incoding Framework for solving this issue, use pattern Model View Dispatcher, which allows you to execute commands and queries without writing trivial actions.

DispatcherControllerBase – doesn't write trivial actions - use it for creating DRY code
public classs DispatcherController : DispatcherControllerBase { public DispatcherController() : base(typeof(Bootstrapper).Assembly) { } }
* MVD covers most scenarios that can occur in web-development with platform ASP.NET MVC. At the same time, if you need to use Attributes you can use it with your queries and commands.
Read more:

Unit tests

Benefits of using unit tests was proved at a huge number of different resources. Unit tests greatly simplify the support of projects. In Incoding Framework as a shell for a quick quality writing unit tests using Mock message.

Persistence test – test your entities with just a few lines of code
[Subject(typeof(Customer))] public classs When_save_Customer : SpecWithPersistenceSpecification<Customer> { It should_be_verify = () => persistenceSpecification.VerifyMappingAndSchema(); }
* Test for entities works with a test database: creates an entity instance with automatically filled fields, saves it in the test database and then retrieves by a key and checks against the initially created instance.
Specification test – check the correctness of data filtering with your WhereSpecification
[Subject(typeof(CustomerBySearchWhereSpec))] public classs When_customer_by_search { Establish establish = () => { Func<string, string, Customer> createEntity = (first, last) => Pleasure.MockStrictAsObject<Customer> (mock => { mock.SetupGet(r => r.First).Returns(first); mock.SetupGet(r => r.Last).Returns(last); }); fakeCollection = Pleasure.ToQueryable(createEntity(Pleasure.Generator.TheSameString(), Pleasure.Generator.TheSameString()), createEntity(Pleasure.Generator.String(), Pleasure.Generator.String())); }; Because of = () => { filterCollection = fakeCollection .Where(new CustomerByNameWhereSpec(Pleasure.Generator.TheSameString()).IsSatisfiedBy()).ToList(); }; It should_be_filter = () => { filterCollection.Count.ShouldEqual(1); filterCollection[0].First.ShouldContain(Pleasure.Generator.TheSameString()); filterCollection[0].Last.ShouldContain(Pleasure.Generator.TheSameString()); }; static IQueryable<Customer> fakeCollection; static List<Customer> filterCollection; }
* With Mock message easy to create a collection with an automatic filling of fields of entities to test the filter specifications.
Query test - carry out inspection faithfulness of your queries
[Subject(typeof(GetCustomersQuery))] public classs When_get_customers { Establish establish = () => { var query = Pleasure.Generator.Invent<GetCustomersQuery>(); customer = Pleasure.Generator.Invent<Customer>(); mockQuery = MockQuery<GetCustomersQuery, List<GetCustomersQuery.Response>> .When(query) .StubQuery(whereSpecification: new CustomerBySearchWhereSpec(query.Search), entities: customer); }; Because of = () => mockQuery.Original.Execute(); It should_be_result = () => mockQuery.ShouldBeIsResult(list => list.ShouldEqualWeakEach(new List<Customer> { customer }, (dsl, i) => dsl.ForwardToValue(r => r.Date, customer.CreateDt.ToShortDateString()) .ForwardToValue(r => r.FullName, customer.First + customer.Last) .ForwardToValue(r => r.Id, customer.Id.ToString()))); static MockMessage<GetCustomersQuery, List<GetCustomersQuery.Response>> mockQuery; static Customer customer; }
* Mock message works with Repository, using mockup (except for testing entities), rather than real implementation that allows testing outside the context database. When inspecting ShouldEqualWeakEach () reconciles the fields collection automatically, but it is also possible to use the methods Forward(), ForwardToValue(), ForwardToAction() and so on for a more fine-tuning.
Command test - follow the proper performance of your commands
[Subject(typeof(AddCustomerCommand))] public classs When_add_customer { static MockMessage<AddCustomerCommand, object> mockCommand; Establish establish = () => { AddCustomerCommand command = Pleasure.Generator.Invent<AddCustomerCommand>(); mockCommand = MockCommand<AddCustomerCommand> .When(command); }; Because of = () => mockCommand.Original.Execute(); It should_be_saved = () => mockCommand.ShouldBeSave<Customer>(customer => customer.ShouldEqualWeak(mockCommand.Original)); }
* Test commands a little different from the test requests - QueryBase<TResult> CommandBase and implement the interface MessageBase<TResult>. The difference lies only in the transaction.
Read more:

Something about Selectors

IML is a declarative language that describes the script of executing code on the client. So Selectors has great importance within Incoding Framework because they can get all of the attributes of DOM-elements on the client side at runtime. IML automatically determines the type of element and based on that information decides which way to get the value should be used.

Selector.Jquery – get all the elements in the DOM in one line of code
var idSelector = Selector.Jquery.ID("id"); var classSelector = Selector.Jquery.Class("class"); var nameSelector = Selector.Jquery.Name("name");
* Selector.Jquery provides standard options for obtaining elements by: Id, Class, Name. Also you can get current element (Selector.Jquery.Self () - analogue event.target). It is also possible to use a typed form of selectors (Html.Selector () ).
Selector.JS и Selector.Incoding – use special selectors for specific issues
var incQueryString = Selector.Incoding.QueryString("key"); var incHashQueryString = Selector.Incoding.HashQueryString("key"); var incHashUrl = Selector.Incoding.HashUrl("key"); var incCookie = Selector.Incoding.Cookie("key"); var incAjax = Selector.Incoding.Ajax(options => { options.Async = true; options.Type = HttpVerbs.Get; options.Url = "url-to-get"; options.Cache = true; }); var jsDateTime = Selector.JS.DateTime.GetDate(); var jsLocation = Selector.JS.Location; var jsGeoLocation = Selector.JS.Navigator; var jsFunctionResult = Selector.JS.Eval("MyFunc()");
* Special selections offer a wide range of opportunities for building client-side scripting: Selector.Incoding provides data that is stored in location, cookies or which is available upon request to the server, Selector.JS produces values that are available in JavaScript - DateTime, Document, GeoLocation, and enables run JS-code.
Read more:

About Templates

In addition to the standard Razor patterns executed by the server, Incoding Framework provides the client template used to convert JSON-data to html. Additional use of customer template makes it easy to use the insertion of JSON-data through Ajax-requests, reduce the amount of traffic due to the transfer compact JSON-data instead of heavy HTML and allows reuse of queries at the mobile development.

Clien template – use your JSON-data from AJAX-query as HTML
using (var template = Html.IncodinG().Template<GetCustomersQuery.Response>()) { <table> <thead> <tr> <th>Id</th> <th>NamE</th> <th>Mark</th> </tr> </thead> @using (var each = template.ForEach()) { <tr> <td>@each.For(r => r.Id)</td> <td>@each.For(r => r.FullName)</td> <td>@each.For(r => r.Mark)</td> </tr> } </table> }
* In Incoding Framework when you create template you should describe only type of model - there is no difference between one object and collection. This eliminates the need to implement With() method that very often doesn't supplied by any template engine.
Read more:

Some projects built using Framework

RAPNDA PROJECT

ReAdmissionProgram and WellBeingDirect software

Vestibulum at mollis neque. Pellentesque tempus, urna sit amet condimentum lacinia, ante justo sodales velit, facilisis commodo orci ipsum in sapien. Donec tellus erat, finibus id nunc eu, vehicula molestie neque. Maecenas viverra semper pellentesque.

About TimeNDA PROJECT

Vestibulum at mollis neque. Pellentesque tempus, urna sit amet condimentum lacinia, ante justo sodales velit, facilisis commodo orci ipsum in sapien.

Pazar3.mkView the project

Vestibulum at mollis neque. Pellentesque tempus, urna sit amet condimentum lacinia, ante justo sodales velit, facilisis commodo orci ipsum in sapien. Donec tellus erat, finibus id nunc eu, vehicula molestie neque. Maecenas viverra semper pellentesque.

CTRNDA PROJECT

Calculating Teachers Rating

Vestibulum at mollis neque. Pellentesque tempus, urna sit amet condimentum lacinia, ante justo sodales velit, facilisis commodo orci ipsum in sapien. Donec tellus erat, finibus id nunc eu, vehicula molestie neque. Maecenas viverra semper pellentesque.

eDatingView the project

Vestibulum at mollis neque. Pellentesque tempus, urna sit amet condimentum lacinia, ante justo sodales velit, facilisis commodo orci ipsum in sapien. Donec tellus erat, finibus id nunc eu, vehicula molestie neque.

Specification – for description your query to data base public classs CustomerBySearchWhereSpec : Specification<Customer> { readonly string _search; public CustomerBySearchWhereSpec(string search) { this._search = search; } public override Expression<Func<Customer, bool>> IsSatisfiedBy() { if (string.IsNotOrWhiteSpace(this._search)) return null; return customer => customer.Last.Contains(this._search) || customer.First.Contains(this._search); } } Query – fetch any data from data base (with read-uncommited transaction) or external source public classs GetCustomersQuery : QueryBase<List<GetCustomersQuery.Response>> { public string Search { get; set; } public classs Response { public string FullName { get; set; } public string Id { get; set; } public string Date { get; set; } } protected override List<Response> ExecuteResult() { return Repository.Query(whereSpecification: new CustomerBySearchWhereSpec(Search)) .ToList() .Select(r => new Response { Id = r.Id.ToString(), FullName = r.First + r.Last, Date = r.CreateDt.ToShortDateString() }) .ToList(); } } Command – use for manipulation with data base (include transaction) or utilities (without open transaction) public classs AddCustomerCommand : CommandBase { public string First { get; set; } public string Last { get; set; } public override void Execute() { Repository.Save(new Customer { First = First, Last = Last, CreateDt = DateTime.UtcNow }); } } Dispatcher – perform your Commands and Queries with UnitOfWork pattern if (!ModelState.IsValid) return IncodingResult.Error(ModelState); try { dispatcher.Push(input); return IncodingResult.Success(); } catch (IncWebException incWebException) { foreach (var error in incWebException.Errors) { foreach (var message in error.Value) ModelState.AddModelError(error.Key, message); } return IncodingResult.Error(ModelState); }