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

Download this episode

Download Video

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

Format

Available formats for this video:

Actual format may change based on video formats available and browser capability.

    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!

    Comments closed

    Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.