Automatically turning controller off around service in ASP.NET MVC

The title of the question may be unclear, but what I want to do looks something like this:

This is how I align my application

App.Domain App.Services App.Web

I want, if I ask for something like /api/OrderProcessor/GetAllOrder, it will call the method GetAllOrderin App.Services.OrderProcessorService.

The method will return IList<Order>, and I would like it to be serialized in JSON according to a specific format (I actually use ExtJS), maybe something like:

{ 
  success: true,
  totalCount: 10,
  list: [ { ... }, { ... } ]
}

I can continue and perform services as controllers, but I do not want the service layer to be corrupted by presentation materials.

How can I make such a wrapper controller?

- , , , , IoC, , , , XML , , DTO .

?

+3
2

, RESTful.

RESTful, URI /api/OrderProcessor/GetAllOrders JSON.

, WCF ASP.NET MVC.

WCF, REST JSON, WCF REST Starter Kit 2 Codeplex. JSON WCF .

!

+2

- PostSharp OnMethodInvocationAspect, -...

0

Source: https://habr.com/ru/post/1711228/


All Articles