.net 6 module/feature structure

Sinan 1 Reputation point
2022-12-05T04:16:14.843+00:00

Hi, I'm not sure if it's the right place for my struggle.

I'm looking for a documentation page, I think it's a Microsoft documentation, it's about .Net 6 web API modular/feature project structure.
I couldn't find the page and I didn't bookmark it. I searched my browser history and still nothing.
The only thing I remember is a little block of code:

Modules  
   User.cs  
      User.requestDTO.cs  
      User.respondDTO.cs  

"requestDTO" and "responseDTO" are not the exact naming used in that tutorial.

We can find a similar tutorial here but I liked what I saw on that page I can't find.
I know it's vague and not really clear but if someone remembers having seen it can you please point it out.

ASP.NET API
ASP.NET API
ASP.NET: A set of technologies in the .NET Framework for building web applications and XML web services.API: A software intermediary that allows two applications to interact with each other.
303 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Lan Huang-MSFT 25,956 Reputation points Microsoft Vendor
    2022-12-05T07:59:41.347+00:00

    Hi @Sinan ,
    We had a hard time finding exactly the documentation you mentioned.
    From your description, you should want to use AutoMapper. You can check the documentation to see if it's what you want.
    https://docs.automapper.org/en/stable/Getting-started.html
    https://github.com/thiago-vivas/Articles/tree/master/AutoMapperWebAPI

    Here are some relevant links I found, hope you have what you are looking for.
    https://learn.microsoft.com/en-us/aspnet/web-api/overview/data/using-web-api-with-entity-framework/part-5
    https://learn.microsoft.com/en-us/aspnet/core/tutorials/first-web-api?view=aspnetcore-7.0&tabs=visual-studio#prevent-over-posting
    https://docs.servicestack.net/api-design

    Best regards,
    Lan Huang


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  2. Bruce (SqlWork.com) 57,241 Reputation points
    2022-12-05T20:57:58.727+00:00

    I don't believe the modules belong in the web application project. the web application should just be the ui components, all modules should be in their own projects. DTO's should never be referenced in a UI projects. The data module should supply proper abstraction of the entities.

    /WebApplication  
       appsetting.json  
       program.cs  
       webaapplication.csproj  
       /controllers  
       /views  
       /models  
      
    /Modules  
      /Module1  
          module1.cs  
          module1.csproj  
          /models  
          /adapters  
      /Module2  
          module2.cs  
          module2.csproj  
          /models  
          /adapters  
      
    

    note: models should be POCO objects, not DTO's. DTO's if used, belong in the data layer.