转: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.
转:ASP.NET MVC 3 and App_Code folder的更多相关文章
- ASP.NET MVC项目中App_Code目录在程序应用
学习ASP.NET MVC,如果你是开发ASP.NET MVC项目的,也许你去为项目添加前ASP.NET项目的APP_Code目录,在这里创建与添加的Class类,也许你无法在MVC项目所引用. 那这 ...
- Mixing ASP.NET Webforms and ASP.NET MVC
https://www.packtpub.com/books/content/mixing-aspnet-webforms-and-aspnet-mvc *********************** ...
- 创建可复用的自定义 ASP.NET MVC Helpers
通常,在ASP.NET MVC项目中App_Code目录下新建.cshtml编写类似下方的代码就能创建自定义的MVC Helper了, 假设文件名为StrHelper.cshtml,那么在别的视图中的 ...
- Asp.Net MVC App_Code无法识别
Asp.Net MVC需要写公共类的时候 右击添加 App_Code 文件夹,新建类—>右击类—>属性,生成操作 —>选择 —>编译 Asp.Net MVC项目本身是个应用程序 ...
- 【Pro ASP.NET MVC 3 Framework】.学习笔记.11.ASP.NET MVC3的细节:概览MVC项目
书Adam The Definitive Guide to HTML5 Adam Applied ASP.NET 4 in Context and Pro ASP.NET 4 到此为止,我们已经学了为 ...
- ASP.NET MVC 3 and the @helper syntax within Razor
Friday, May 13, 2011 ASP.NET MVC 3 supports a new view-engine option called “Razor” (in addition to ...
- 翻译:使用 ASP.NET MVC 4, EF, Knockoutjs and Bootstrap 设计和开发站点 - 3
原文地址:http://ddmvc4.codeplex.com/ 原文名称:Design and Develop a website using ASP.NET MVC 4, EF, Knockout ...
- 七天学会ASP.NET MVC (六)——线程问题、异常处理、自定义URL
本节又带了一些常用的,却很难理解的问题,本节从文件上传功能的实现引出了线程使用,介绍了线程饥饿的解决方法,异常处理方法,了解RouteTable自定义路径 . 系列文章 七天学会ASP.NET MVC ...
- 4、ASP.NET MVC入门到精通——NHibernate构建一个ASP.NET MVC应用程序
下周就去办理离职手续了,之前没有使用过NHibernate,只知道NHibernate是一种ORM框架,但是听说新公司是使用NHibernate在做项目,所以,我就网上找资料学习一下NHibernat ...
随机推荐
- 转载ASP.net 中 OutputCache 指令各个参数的作用
使用@ OutputCache指令 使用@ OutputCache指令,能够实现对页面输出缓存的一般性需要.@ OutputCache指令在ASP.NET页或者页中包含的用户控件的头部声明.这种方式非 ...
- ng-cookie 的基本使用
2.angular-cookie - 配置$cookiesProvider ```angular.module("Demo",[]).config(["$cookiesP ...
- C++学习笔记(二):基本数据类型
带符号整数: short至少16位: int至少与short—样长: long至少32位,且至少与int—样长: long long至少64位,且至少与long—样长: 无符号整数: unsigned ...
- CentOS6.5安装telnet
原文地址:http://www.cnblogs.com/zhongshengzhen/ 1.检查是否已经安装telnet [root@localhost ~]# rpm -qa | grep teln ...
- Windows 环境下基于 Redis 的 Celery 任务调度模块的实现
搭建环境: Windows-x64 10 Celery 3.1.23 Celery-with-redis 3.0 Redis-win32-win64 2.4.5 实现步骤: 1.安装 Redis ...
- UIDatePicker 之显示中文 年月日
picker_start=[[UIDatePicker alloc]initWithFrame:CGRectMake(centerView.frame.size.width/-,centerView. ...
- SliderSkin
<?xml version="1.0" encoding="utf-8"?> <s:Skin xmlns:fx="http://ns ...
- Codeforces Round #322 (Div. 2) B. Luxurious Houses 水题
B. Luxurious Houses Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/581/pr ...
- .NET分布式事务处理总结【下】 - 包含MSMQ的分布式事务处理
转自:http://www.cnblogs.com/daxnet/archive/2011/03/15/1984995.html .NET直接提供对MSMQ的访问支持,只需要添加System.Mess ...
- Struts1中ActionForward的技巧介绍
ActionForward是做什么的?他是用来封装转发和重定向路径的. 在struts- config.xml中<forward name="error" path=&quo ...