Web API Business Layer Architecture and its responsibilities










3















I have following classes in my web api business layer, i was wondering if GatewayService class should be in Business layer or should i put that in separate project called BusinessService? because its not being directly called in controller class and it doesn't depend on data repository ?



Business Layer



  • GatewayService (referencing < dll file > methods and making calls to external web service and returning list of transactions)

  • UserService (returns a list of all users from production database using < repository class > from data layer)

  • TransactionService ( get a list of all users from < UserService > and then get all their transactions from < Gateway Service > )

Here is what Transaction Controller doing;



Transaction Controller




Getting a list of users from < UserService >



Passing a list of Users to < TransactionService > which will then return a list of user transactions



Passing a list of all transactions to < TransactionService > to process them through a data repository class











share|improve this question


























    3















    I have following classes in my web api business layer, i was wondering if GatewayService class should be in Business layer or should i put that in separate project called BusinessService? because its not being directly called in controller class and it doesn't depend on data repository ?



    Business Layer



    • GatewayService (referencing < dll file > methods and making calls to external web service and returning list of transactions)

    • UserService (returns a list of all users from production database using < repository class > from data layer)

    • TransactionService ( get a list of all users from < UserService > and then get all their transactions from < Gateway Service > )

    Here is what Transaction Controller doing;



    Transaction Controller




    Getting a list of users from < UserService >



    Passing a list of Users to < TransactionService > which will then return a list of user transactions



    Passing a list of all transactions to < TransactionService > to process them through a data repository class











    share|improve this question
























      3












      3








      3


      1






      I have following classes in my web api business layer, i was wondering if GatewayService class should be in Business layer or should i put that in separate project called BusinessService? because its not being directly called in controller class and it doesn't depend on data repository ?



      Business Layer



      • GatewayService (referencing < dll file > methods and making calls to external web service and returning list of transactions)

      • UserService (returns a list of all users from production database using < repository class > from data layer)

      • TransactionService ( get a list of all users from < UserService > and then get all their transactions from < Gateway Service > )

      Here is what Transaction Controller doing;



      Transaction Controller




      Getting a list of users from < UserService >



      Passing a list of Users to < TransactionService > which will then return a list of user transactions



      Passing a list of all transactions to < TransactionService > to process them through a data repository class











      share|improve this question














      I have following classes in my web api business layer, i was wondering if GatewayService class should be in Business layer or should i put that in separate project called BusinessService? because its not being directly called in controller class and it doesn't depend on data repository ?



      Business Layer



      • GatewayService (referencing < dll file > methods and making calls to external web service and returning list of transactions)

      • UserService (returns a list of all users from production database using < repository class > from data layer)

      • TransactionService ( get a list of all users from < UserService > and then get all their transactions from < Gateway Service > )

      Here is what Transaction Controller doing;



      Transaction Controller




      Getting a list of users from < UserService >



      Passing a list of Users to < TransactionService > which will then return a list of user transactions



      Passing a list of all transactions to < TransactionService > to process them through a data repository class








      c# asp.net-web-api architecture asp.net-web-api2 business-logic-layer






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 14 '18 at 22:14









      user1263981user1263981

      1,20263066




      1,20263066






















          2 Answers
          2






          active

          oldest

          votes


















          1














          In case of N-Layer architecture



          TransactionService should be in an Application layer, then your GatewayService can be part of the Business Layer.



          enter image description here



          In case of Clean Architecture



          GatewayService should be part of Presistence or Infrastracture layer so it is not a business layer (here domain and application).



          enter image description here






          share|improve this answer

























          • i have never seen a Application Layer in WEB API project.

            – user1263981
            Nov 14 '18 at 22:29











          • It does not matter if it is WEB API, MVC, or a ConsoleApp. It is about structure of your modules and finding a middle ground between speed and efficiency. In case of n-layer check the ABP project, in case of Clean Architecture JasonGT/NorthwindTraders project on github

            – Sebastian 506563
            Nov 14 '18 at 22:32












          • What about User Service? would this stay in Business Layer?

            – user1263981
            Nov 14 '18 at 22:47











          • In n-layered yes it is.

            – Sebastian 506563
            Nov 14 '18 at 22:50











          • Can i call my Application layer a ApplicationService ?

            – user1263981
            Nov 14 '18 at 22:51



















          0














          It would be a part of the business layer. The business layer is where you would implement the external requirements for your system fx. logistics and so. Which falls under the same category as your gateway service.








          share|improve this answer
























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53309535%2fweb-api-business-layer-architecture-and-its-responsibilities%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            In case of N-Layer architecture



            TransactionService should be in an Application layer, then your GatewayService can be part of the Business Layer.



            enter image description here



            In case of Clean Architecture



            GatewayService should be part of Presistence or Infrastracture layer so it is not a business layer (here domain and application).



            enter image description here






            share|improve this answer

























            • i have never seen a Application Layer in WEB API project.

              – user1263981
              Nov 14 '18 at 22:29











            • It does not matter if it is WEB API, MVC, or a ConsoleApp. It is about structure of your modules and finding a middle ground between speed and efficiency. In case of n-layer check the ABP project, in case of Clean Architecture JasonGT/NorthwindTraders project on github

              – Sebastian 506563
              Nov 14 '18 at 22:32












            • What about User Service? would this stay in Business Layer?

              – user1263981
              Nov 14 '18 at 22:47











            • In n-layered yes it is.

              – Sebastian 506563
              Nov 14 '18 at 22:50











            • Can i call my Application layer a ApplicationService ?

              – user1263981
              Nov 14 '18 at 22:51
















            1














            In case of N-Layer architecture



            TransactionService should be in an Application layer, then your GatewayService can be part of the Business Layer.



            enter image description here



            In case of Clean Architecture



            GatewayService should be part of Presistence or Infrastracture layer so it is not a business layer (here domain and application).



            enter image description here






            share|improve this answer

























            • i have never seen a Application Layer in WEB API project.

              – user1263981
              Nov 14 '18 at 22:29











            • It does not matter if it is WEB API, MVC, or a ConsoleApp. It is about structure of your modules and finding a middle ground between speed and efficiency. In case of n-layer check the ABP project, in case of Clean Architecture JasonGT/NorthwindTraders project on github

              – Sebastian 506563
              Nov 14 '18 at 22:32












            • What about User Service? would this stay in Business Layer?

              – user1263981
              Nov 14 '18 at 22:47











            • In n-layered yes it is.

              – Sebastian 506563
              Nov 14 '18 at 22:50











            • Can i call my Application layer a ApplicationService ?

              – user1263981
              Nov 14 '18 at 22:51














            1












            1








            1







            In case of N-Layer architecture



            TransactionService should be in an Application layer, then your GatewayService can be part of the Business Layer.



            enter image description here



            In case of Clean Architecture



            GatewayService should be part of Presistence or Infrastracture layer so it is not a business layer (here domain and application).



            enter image description here






            share|improve this answer















            In case of N-Layer architecture



            TransactionService should be in an Application layer, then your GatewayService can be part of the Business Layer.



            enter image description here



            In case of Clean Architecture



            GatewayService should be part of Presistence or Infrastracture layer so it is not a business layer (here domain and application).



            enter image description here







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Nov 14 '18 at 22:29

























            answered Nov 14 '18 at 22:27









            Sebastian 506563Sebastian 506563

            2,31622241




            2,31622241












            • i have never seen a Application Layer in WEB API project.

              – user1263981
              Nov 14 '18 at 22:29











            • It does not matter if it is WEB API, MVC, or a ConsoleApp. It is about structure of your modules and finding a middle ground between speed and efficiency. In case of n-layer check the ABP project, in case of Clean Architecture JasonGT/NorthwindTraders project on github

              – Sebastian 506563
              Nov 14 '18 at 22:32












            • What about User Service? would this stay in Business Layer?

              – user1263981
              Nov 14 '18 at 22:47











            • In n-layered yes it is.

              – Sebastian 506563
              Nov 14 '18 at 22:50











            • Can i call my Application layer a ApplicationService ?

              – user1263981
              Nov 14 '18 at 22:51


















            • i have never seen a Application Layer in WEB API project.

              – user1263981
              Nov 14 '18 at 22:29











            • It does not matter if it is WEB API, MVC, or a ConsoleApp. It is about structure of your modules and finding a middle ground between speed and efficiency. In case of n-layer check the ABP project, in case of Clean Architecture JasonGT/NorthwindTraders project on github

              – Sebastian 506563
              Nov 14 '18 at 22:32












            • What about User Service? would this stay in Business Layer?

              – user1263981
              Nov 14 '18 at 22:47











            • In n-layered yes it is.

              – Sebastian 506563
              Nov 14 '18 at 22:50











            • Can i call my Application layer a ApplicationService ?

              – user1263981
              Nov 14 '18 at 22:51

















            i have never seen a Application Layer in WEB API project.

            – user1263981
            Nov 14 '18 at 22:29





            i have never seen a Application Layer in WEB API project.

            – user1263981
            Nov 14 '18 at 22:29













            It does not matter if it is WEB API, MVC, or a ConsoleApp. It is about structure of your modules and finding a middle ground between speed and efficiency. In case of n-layer check the ABP project, in case of Clean Architecture JasonGT/NorthwindTraders project on github

            – Sebastian 506563
            Nov 14 '18 at 22:32






            It does not matter if it is WEB API, MVC, or a ConsoleApp. It is about structure of your modules and finding a middle ground between speed and efficiency. In case of n-layer check the ABP project, in case of Clean Architecture JasonGT/NorthwindTraders project on github

            – Sebastian 506563
            Nov 14 '18 at 22:32














            What about User Service? would this stay in Business Layer?

            – user1263981
            Nov 14 '18 at 22:47





            What about User Service? would this stay in Business Layer?

            – user1263981
            Nov 14 '18 at 22:47













            In n-layered yes it is.

            – Sebastian 506563
            Nov 14 '18 at 22:50





            In n-layered yes it is.

            – Sebastian 506563
            Nov 14 '18 at 22:50













            Can i call my Application layer a ApplicationService ?

            – user1263981
            Nov 14 '18 at 22:51






            Can i call my Application layer a ApplicationService ?

            – user1263981
            Nov 14 '18 at 22:51














            0














            It would be a part of the business layer. The business layer is where you would implement the external requirements for your system fx. logistics and so. Which falls under the same category as your gateway service.








            share|improve this answer





























              0














              It would be a part of the business layer. The business layer is where you would implement the external requirements for your system fx. logistics and so. Which falls under the same category as your gateway service.








              share|improve this answer



























                0












                0








                0







                It would be a part of the business layer. The business layer is where you would implement the external requirements for your system fx. logistics and so. Which falls under the same category as your gateway service.








                share|improve this answer















                It would be a part of the business layer. The business layer is where you would implement the external requirements for your system fx. logistics and so. Which falls under the same category as your gateway service.









                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Dec 12 '18 at 7:05









                Pang

                6,9391664102




                6,9391664102










                answered Nov 14 '18 at 22:36









                Max Barly JørgensenMax Barly Jørgensen

                32




                32



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53309535%2fweb-api-business-layer-architecture-and-its-responsibilities%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    這個網誌中的熱門文章

                    How to read a connectionString WITH PROVIDER in .NET Core?

                    Museum of Modern and Contemporary Art of Trento and Rovereto

                    In R, how to develop a multiplot heatmap.2 figure showing key labels successfully