locked
System Design - ASP.Net MVC Preparations RRS feed

  • Question

  • User1242168447 posted

    I'm about to start an asp.net mvc project with Repositorty-Service pattern and I'm first gathering information.

    Therefore I've got few questions that I need clarification before I start implementing. 

    In my company, most of the asp.net mvc projects developed by senior developers possess common features such as :   

    • Caching mechanism 
    • logging 
    • Security (Encryption - AES...)   

    So my questions are :   

    1) Do I always need a caching mechanism and logging and Security(Encryption - AES...) in an asp.net mvc app?   

    2) When do I need them? I mean in what situation do I need caching and logging and Security(Encryption)? please give me detailed answer for each for clarification.   

    3) Is it fine/professional to use in a real-world asp.net project, the default ASP.Net MVC authentication code that gets generated when you create a new asp.net app?    as I'm building a quite big asp.net (not very big) web app with Repositorty-Service pattern and I just want to reuse the default MS ASP.Net authentication (to save me time) instead of writing a new one.   

    4) Do I need to use SQL Server or MongoDB as database? I know that MongoDB is best suited for scalability but I don't want to use a library which I'll be forced to dig in to its library DLL and modify some code in order to make it work, as I don't want to waste my time as the project is timed.

    Sunday, May 31, 2020 3:17 PM

Answers

  • User1242168447 posted

    My team were consultant / temporary, so all seniors left the company.

    I'm asking them as a general question on system design when designing a real-world asp.net mvc app.

    It's not really specific to our team or company as you can find them in  Exam Ref 70-486 : Developing ASP.NET MVC 4 Web Applications  book.

    I just want some real world broad ideas from professional folks, then I can try to accommodate it in my project.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, May 31, 2020 7:46 PM
  • User1120430333 posted


    1) Do I always need a caching mechanism and logging and Security(Encryption - AES...) in an asp.net mvc app?
    2) When do I need them? I mean in what situation do I need caching and logging and Security(Encryption)? please give me detailed answer for each for clarification.

    The cashing and encryption is not always warranted.  The  encryption need may be based on what the power end-user states and IT management directs, if you can't make the determination on your own. Caching may  be needed to reduce the round trip to read static data from a database as an example. Why keep reading the same data over and over, just cache it in memory. 

    As for logging, the solution should have global exception handling and logging of the exception. You don't need a try/catch in any code making all exceptions unhandeled that are caught by the GHE and exceptions are caught in a referenced DLL that has no try/catch in it.

    https://stackify.com/csharp-catch-all-exceptions/

    3) Is it fine/professional to use in a real-world asp.net project, the default ASP.Net MVC authentication code that gets generated when you create a new asp.net app?

    Yes, that it is what it is there for to use and many ASP.NET solution use ASP.NET Identity.

    as I'm building a quite big asp.net (not very big) web app with Repository-Service pattern and I just want to reuse the default MS ASP.Net authentication

    It sounds like you're about to go down the generic repository path doing CRUD with a repository object. The repository object does not persist data to the database, no add, update or delete. The repository pattern is a domain pattern.

    And EF besides, EF is already  using the UoW and repository pattern and coding the UoW and repository patterns over the top of what EF is already doing is not optimal.

    https://martinfowler.com/eaaCatalog/repository.html

    https://programmingwithmosh.com/net/common-mistakes-with-the-repository-pattern/

    https://docs.microsoft.com/en-us/dotnet/api/system.data.entity.dbcontext?view=entity-framework-6.2.0

    Do I need to use SQL Server or MongoDB as database? I know that MongoDB is best suited for scalability but I don't want to use a library which I'll be forced to dig in to its library DLL and modify some code in order to make it work, as I don't want to waste my time as the project is timed.

    IMHO, you need to go with MS SQL Server and the ADO.NET Entity Framework. And what makes you think that MS SQL Server is not scalable?

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, May 31, 2020 9:53 PM
  • User-474980206 posted

    caching is useful, but optional beyond what mvc supports.

    You need logging. How else will determine where your performance problems are, or how to determine source of runtime errors.

    you most likely do not need the repository pattern, pick a good ORM.

    sql is a relational database, mongo dB is a document database. They have different features and use cases. We would need your full system requirements to recommend one over the other. If you don’t understand, your company should hire a consultant to review your design and make suggestions.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, May 31, 2020 10:13 PM

All replies

  • User475983607 posted

    Seems that you team has design standards.  Isn't this a better question for your team?  

    Sunday, May 31, 2020 5:12 PM
  • User1242168447 posted

    My team were consultant / temporary, so all seniors left the company.

    I'm asking them as a general question on system design when designing a real-world asp.net mvc app.

    It's not really specific to our team or company as you can find them in  Exam Ref 70-486 : Developing ASP.NET MVC 4 Web Applications  book.

    I just want some real world broad ideas from professional folks, then I can try to accommodate it in my project.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, May 31, 2020 7:46 PM
  • User475983607 posted

    Yes, it is very common to find logging, caching, and encryption in an application.   These are all tools.  Logging is used to check the healthy of the system.  Caching increases throughput.  Encryption is used when you want to secure data.  How these tools are used can vary depending on what you are trying to accomplish.  

    Sunday, May 31, 2020 9:33 PM
  • User1120430333 posted


    1) Do I always need a caching mechanism and logging and Security(Encryption - AES...) in an asp.net mvc app?
    2) When do I need them? I mean in what situation do I need caching and logging and Security(Encryption)? please give me detailed answer for each for clarification.

    The cashing and encryption is not always warranted.  The  encryption need may be based on what the power end-user states and IT management directs, if you can't make the determination on your own. Caching may  be needed to reduce the round trip to read static data from a database as an example. Why keep reading the same data over and over, just cache it in memory. 

    As for logging, the solution should have global exception handling and logging of the exception. You don't need a try/catch in any code making all exceptions unhandeled that are caught by the GHE and exceptions are caught in a referenced DLL that has no try/catch in it.

    https://stackify.com/csharp-catch-all-exceptions/

    3) Is it fine/professional to use in a real-world asp.net project, the default ASP.Net MVC authentication code that gets generated when you create a new asp.net app?

    Yes, that it is what it is there for to use and many ASP.NET solution use ASP.NET Identity.

    as I'm building a quite big asp.net (not very big) web app with Repository-Service pattern and I just want to reuse the default MS ASP.Net authentication

    It sounds like you're about to go down the generic repository path doing CRUD with a repository object. The repository object does not persist data to the database, no add, update or delete. The repository pattern is a domain pattern.

    And EF besides, EF is already  using the UoW and repository pattern and coding the UoW and repository patterns over the top of what EF is already doing is not optimal.

    https://martinfowler.com/eaaCatalog/repository.html

    https://programmingwithmosh.com/net/common-mistakes-with-the-repository-pattern/

    https://docs.microsoft.com/en-us/dotnet/api/system.data.entity.dbcontext?view=entity-framework-6.2.0

    Do I need to use SQL Server or MongoDB as database? I know that MongoDB is best suited for scalability but I don't want to use a library which I'll be forced to dig in to its library DLL and modify some code in order to make it work, as I don't want to waste my time as the project is timed.

    IMHO, you need to go with MS SQL Server and the ADO.NET Entity Framework. And what makes you think that MS SQL Server is not scalable?

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, May 31, 2020 9:53 PM
  • User-474980206 posted

    caching is useful, but optional beyond what mvc supports.

    You need logging. How else will determine where your performance problems are, or how to determine source of runtime errors.

    you most likely do not need the repository pattern, pick a good ORM.

    sql is a relational database, mongo dB is a document database. They have different features and use cases. We would need your full system requirements to recommend one over the other. If you don’t understand, your company should hire a consultant to review your design and make suggestions.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, May 31, 2020 10:13 PM