ASP.NET Monsters #52: Loading View Components from a Class Library

Sign in to queue

Description

View Components are a new feature in ASP.NET Core MVC and they provide a great way to build small components that can be reused across your application. In today's episode, Dave shows us how to load view components from a class library so they can be shared across several applications.

Resources

Blog Post
GitHub Repo

 

Tags:

ASP.NET, MVC

Embed

Download

Download this episode

The Discussion

  • User profile image
    Dennis Smits

    Nice, would love to see more about the plug-in framework concept and how you look at it.

  • User profile image
    mohamed abdelhalim mohamed

    how can I learn from starting ?

  • User profile image
    Thien

    Another approach is using ApplicationPart. You can check it out at https://github.com/simplcommerce/SimplCommerce

  • User profile image
    JohnMarsing

    What would be some good use cases for ViewComponents?  I think I say one on menu

  • User profile image
    David​Paquette

    @JohnMarsing: I think the main menu is a good example or even the Login / Register / My Account section of the menu would be a good use case for a ViewComponent.

    Another example I use often is something like a news feed. I like the News feed example because it needs to access a datasource so it can't be easily implemented as a partial view. Check out my blog post for an example of the News feed view component.

  • User profile image
    MalachiB

    I really liked this.  Small, bite size but very informative.  Also you guys have good chemistry, the banter and mild joking dovetails into more interesting thoughts.  Keep it up!

Add Your 2 Cents