{"id":18758782,"url":"https://github.com/tsimbalar/mvcarchiproto","last_synced_at":"2025-08-22T00:22:43.206Z","repository":{"id":5398156,"uuid":"6587565","full_name":"tsimbalar/MvcArchiProto","owner":"tsimbalar","description":null,"archived":false,"fork":false,"pushed_at":"2013-04-17T06:44:11.000Z","size":16244,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-29T03:29:07.346Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tsimbalar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-11-07T22:34:03.000Z","updated_at":"2013-12-31T14:21:55.000Z","dependencies_parsed_at":"2022-07-06T15:32:49.451Z","dependency_job_id":null,"html_url":"https://github.com/tsimbalar/MvcArchiProto","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsimbalar%2FMvcArchiProto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsimbalar%2FMvcArchiProto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsimbalar%2FMvcArchiProto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsimbalar%2FMvcArchiProto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tsimbalar","download_url":"https://codeload.github.com/tsimbalar/MvcArchiProto/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239650785,"owners_count":19674810,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T17:47:55.733Z","updated_at":"2025-02-19T11:43:39.988Z","avatar_url":"https://github.com/tsimbalar.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"MvcArchiProto\n=============\n\nJust an experiment of architecture for loose coupling in an ASP.NET MVC App.\n\nThe idea is that client code should just need to create an instance of a [`Request`](https://github.com/tsimbalar/MvcArchiProto/blob/master/WebApp/Experimentations/IRequest.cs) object (similar to a Command object, that is, it contains all the necessary information for an action to be executed) and pass it to a [`IRequestDispatcher`](https://github.com/tsimbalar/MvcArchiProto/blob/master/WebApp/Experimentations/IRequestDispatcher.cs) that would take care of : \n- finding which implementation of a service to pass it to (using a [`ServiceRegistry`](https://github.com/tsimbalar/MvcArchiProto/blob/master/WebApp/Experimentations/IServiceRegistry.cs), implemented [thanks to an IoC Container, for instance](https://github.com/tsimbalar/MvcArchiProto/blob/master/WebApp/Experimentations/Tuyauterie/UnityServiceRegistry.cs))\n- invoke `IExecutableService.Execute()` on that service, passing it the request\n- return the `Response` returned by the Execute() method.\n\nFor the client code, it looks like this : \n```C#\npublic ActionResult Index()\n{\n    var request = new CapitalizeRequest(); // CapitalizeRequest : IRequest\u003cCapitalizeRequest, CapitalizeResponse\u003e\n    request.Blob = \"bidule\";\n\n    var response = _dispatcher.Execute(request); // _dispatcher is a IRequestDispatcher initialized via constructor injection\n    // response is of type CapitalizeResponse\n    return View(response.CapitalizedBlob);\n}\n```\n\n\nWhat the [`RequestDispatcher`](https://github.com/tsimbalar/MvcArchiProto/blob/master/WebApp/Experimentations/Tuyauterie/RequestDispatcher.cs) does is to look inside our IoC container (in our case, Unity) if it finds any implementation of interface [`IExecutableService`](https://github.com/tsimbalar/MvcArchiProto/blob/master/WebApp/Experimentations/IExecutableService.cs) defined as :\n```C#\npublic interface IExecutableService\n{\n    TResponse Execute(TRequest request);\n}\n```\n... and call that service with the request and return the Response.\n\nWe also have an Async version : [`IAsyncExecutableService`](https://github.com/tsimbalar/MvcArchiProto/blob/master/WebApp/Experimentations/IAsyncExecutableService.cs) and corresponding [Async version of `RequestDispatcher`](https://github.com/tsimbalar/MvcArchiProto/blob/master/WebApp/Experimentations/Tuyauterie/AsyncRequestDispatcher.cs) : [`IAsyncRequestDispatcher`](https://github.com/tsimbalar/MvcArchiProto/blob/master/WebApp/Experimentations/IAsyncRequestDispatcher.cs).\n\nIt is not quite Command-Query Segregation, hence the names **Response/Request**.\n\n\nSee Also\n--------\n\nYou may also be interested in this post by Jef Claes : http://www.jefclaes.be/2013/01/separating-command-data-from-logic-and.html , which uses the same idea to execute Commands...\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftsimbalar%2Fmvcarchiproto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftsimbalar%2Fmvcarchiproto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftsimbalar%2Fmvcarchiproto/lists"}