zoukankan      html  css  js  c++  java
  • 转:ASP.NET MVC 3 and App_Code folder

    问题:

    In ASP.NET Webform, App_Code is standardfolder to putting code and using it at run-time.But I think this folder is kind of different in ASP.NET MVC, my question is:

    • where should I put my code ( Extension methods , Helpers , ... ) in ASP.NET MVC. When I store code in App_Code folder, I can't use theme in controller but they work fine in views.

    • About Entity Framework, the same question, where should I put edmx and tt files. I'm not using Code-First

    Update:

    After some search, finally I created a new Class Library project in my solution, code is available in allcontrollers and views. I still don't know why the code in App_Code is not available in controller

    回答 :

    App_Code is necessary in Web Site projects because it has a special meaning. It means "Don't serve these files to a web browser". In ASP.NET MVC, files are not directly served to the browser in most cases, so App_Code is not necessary. You can place code files whereever you want, in any folder you want.

    Using a stand-alone library is also a fine solution.

     
     
  • 相关阅读:
    async中series的实现 javascript构件
    6.算法-计数排序
    5.算法-快速排序
    4.堆排序
    3.分治法研究-搜索数组中的最长连续递增子集
    字典树(Trie)学习笔记
    并查集笔记
    求树的遍历
    P1087 FBI树
    P5017 摆渡车
  • 原文地址:https://www.cnblogs.com/gdlixiaoyu/p/4554807.html
Copyright © 2011-2022 走看看