Content Deep Dive
Using C# Interfaces as View Models With ASP.NET Core 3.1 Razor Pages in MVVM Design
Blog post from Twilio
Post Details
Company
Date Published
Author
AJ Saulsberry
Word Count
2,919
Language
English
Hacker News Points
-
Summary
The post discusses using C# interfaces as view models with ASP.NET Core 3.1 Razor Pages in an MVVM design pattern, exploring limitations and potential alternatives for this approach. The author provides a case study application to demonstrate the use of interfaces for view models and tests their limits by attempting to bind them to the page model. The post concludes that while using interfaces as view models can add flexibility, it may not be practical in all cases due to constraints on binding and abstraction. It suggests considering additional design patterns, such as inversion of control containers and dependency injection, to achieve further abstraction and decoupling.