asp.net - Create Controller and add Views to another project -
visual studio 2015 + updates. asp .net web application (mvc).
i start off adding few class libraries , separating asp .net wa layers i.e. dataaccess, business logic , web project itself.
once separated add relevant references , working expect (i.e. application functions did before separated layers).
in bl (controllers found here). don't have option add controller, when right clicking controllers folder in default project, add below line
<projecttypeguids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</projecttypeguids>
to csproj file class library , add controller option appears. create controller throws error due not having web.config file - add file , works (although nice have library working without web.config file).
the problem i've hit is, when controller created adds view template within class library views folder located in web project.
have done wrong? there workaround when controller created, creates views correct project? or approach this?
this guess, seems try use ui-based architectural pattern build business layer.
typically, models, views, , controllers maintained in main web-app project. supporting functions (like bl , dl) added via class libraries. visual studio mvc templates built around concept, why had manually add support guid - , why automatically creates view.
if may ask, why trying build controllers bl? if trying decouple ui server code, perhaps webapi better option.
update - few helpful links
prodinner - asp.net mvc sample app
n layered app entity framework, autofac, asp.net mvc , unit testing
architecture guide: asp.net mvc framework + n-tier + entity framework , many more
Comments
Post a Comment