开发者

Can an ASP.NET MVC3 Controller (and View?) be redistributed as a class library dll?

开发者 https://www.devze.com 2023-02-13 22:08 出处:网络
is it possible to add a single Controller and possibly a view or two, in a class library ... 开发者_如何转开发which could then be redistributed (ie. via NuGet) and reused in various applications?

is it possible to add a single Controller and possibly a view or two, in a class library ... 开发者_如何转开发which could then be redistributed (ie. via NuGet) and reused in various applications?

I'm thinking of providing a default view (or two) but allowing the consumer to override this view via a public property.

Possible?


There is nothing built-in ASP.NET MVC 3 allowing you to embed views into class libraries (controllers, yes, but not views). It is necessary to write a custom VirtualPathProvider. Here's a blog post which might put you on the right track. And you could also take a look at MVCContrib portable areas which allows you to do this.

0

精彩评论

暂无评论...
验证码 换一张
取 消