Home Sharing controller and views between projects
Reply: 2

Sharing controller and views between projects

david Published in 2017-09-10 14:34:06Z

I am trying to create a good infrastructure for my web framework I am developing I have the following structure so far

solitude.admin web project to keep the controlers and views in how do I create this one I created a class libary but see you cannot have a web.config there

solitude.core will contain all my utililties and models

solitude.framework will be the core and meat of the cms platform my quesiton is how does one create a class libary project for asp.net mvc 4.6 to allow controllers and views to be shared i addded razor to a dll but i dont think that is correct approach

solitude.mvc this will contain the front end of the site i tried the below changing project guids to allow the sharing but its not working

I also changed the project type guids as suggested on aricltes on so but no joy I am trying to mimic our other platforms already work to futher my understanding.


Another point is if I was two have two sep projects admin and web how would one tell it to go to admin if user types www.domain.com/admin but yet be two independent web projects?.

José Cordero
José Cordero Reply to 2017-09-10 14:41:49Z

I see good the separation of concerns. But have some questions:

1.- Why not making "solitude.admin" another web app project?

2.- Why aren't you using the expected naming conventions? That is a lot of lowercases you got there.

3.- Why would you like/need to share Controllers? Basically, there must be a

return View();

inside them.

For views, you could create some components based on parameters (which mostly, it comes to print out some HTML). You already have Shared Views but for the same project.

Ben Junior
Ben Junior Reply to 2017-10-04 14:15:57Z

I totally understand you. I'm in the same situation. I suggest you take a look at AREAS. I'm still learning it, but for what I've googled, it is the proper way to share views and controllers between projects. This is one good link

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.386152 second(s) , Gzip On .

© 2016 Powered by cudou.com design MATCHINFO