开发者

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

开发者 https://www.devze.com 2023-03-07 17:16 出处:网络
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).

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

精彩评论

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

关注公众号