开发者

With MVC3 can I call / use a view that's in another project?

I didn't see anyone talking about this. What I have is login logic that's common to three projects. I have my model in one project (shared).

Can I have the controller and views in another shared project? I just don't want to have to duplicate things in each.

Also interested in any other ideas people may have to solve this problem.

开发者_StackOverflow中文版

Robert


Take a look at Precompiled Razor Views


Well, when it comes down to loading views, you can implement your own ViewEngine and instruct it to load your view from wherever you want (database, dll, ...). I just saw a nice video from TechEd NA yesterday, where the creator of the spark view engine shows how to implement it. In your case, you can just fetch the view and feed it into the razor view engine. You should have no problems, since razor was designed to be flexible, and you can easily spawn your own instance of the engine to have it render your loaded view.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜