Using a generic model in ASP.NET MVC Razor

前端 未结 5 1767
刺人心
刺人心 2020-12-29 01:15

Is it possible to use a generic model in ASP.NET MVC 3 (w/ Razor)? The following fails with a syntax error:

@model DtoViewModel where T : IDto
         


        
5条回答
  •  余生分开走
    2020-12-29 01:31

    I found this thread and did some further digging. Looks like the feature is on the 2.2.0 backlog. If anyone wants to get involved you can check out the issue on Github. https://github.com/aspnet/Mvc/issues/7152

提交回复
热议问题