#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2016
    Posts
    1
    Rep Power
    0

    .net 5 / MVC 6 / MVVM UI Best Practice


    Hello,

    I'm new to the .net 5 / asp world (php background) and could really use some help as far as figuring out an architecture to adopt for Web apps like a cms, shopping cart, user account system...etc

    Should I use the traditional MVC approach with views or a Web api approach to pass data to/from the server via knockoutjs MVVM...

    Really looking for industry standard approach as far as high level architecture for a Web app that's like a cms.

    Thanks!
  2. #2
  3. Forgotten Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,093
    Rep Power
    9644
    There is no industry standard. Those are two different architectures, neither one more legitimate or standardized or inherently "better" than the other.

    Go with something you understand.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2014
    Posts
    40
    Rep Power
    3
    1
    down vote


    In a simple application, I often see two projects in a solution, An MVC project for the web front-end and a class library for data access, lets call that "core". The core project contains all of the ORM related classes and a service class implementing an interface, lets call it IService which handles business logic.

    When a request comes in to the MVC controller, the controller will call IService to pull back the data it needs and pass that information onto the view. In this approach there aren't any "Models" in your MVC folder, but the ORM Model is being used. For more complex pages, you would create an MVC Model, to combine several pieces of data returned from ISservice and present them in a way that makes sense to the user.

    In a larger project, the core project which contains IService may be 1-many WCF or Web API services. This gives you more flexibility for scaling the application and allows your web pages to make ajax calls directly to the data layer.

    In this scenario, when a request comes into the controller, it would still call IService, but this service is actually a WCF or Web API service.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2016
    Posts
    54
    Rep Power
    2
    For the database end of it, you should use, Entity frame work, from .Net
    It will remind you so much of laravel, if you used that with php.

    LINQ for .Net, is just a nicer version of the query builder from laravel.

    If you used the MVC architecture in PHP, there is no issue using the MVC architecture in .Net, there are hardly, if any, differences.

    Depending on the complexity of you project, applying the MVC model to your layers, could be a good choice, be if the task is simple and short, then perhaps time and money would be saved, if you just passed entity framework objects directly to the MVC viewbag. (Not that I would ever suggest that for any serious project)

IMN logo majestic logo threadwatch logo seochat tools logo