简体   繁体   English

ASP.NET + Linq到SQL

[英]ASP.NET + Linq to SQL

I have a class in my App_Code directory that I'm trying to initialize from the root directory of my solution but it is not showing up in IntelliSense. 我的App_Code目录中有一个类,我正在尝试从解决方案的根目录中进行初始化,但该类未在IntelliSense中显示。 I have tried changing the class's build action from Content to Compile but then IntelliSense throws a whole bunch of errors about not finding my DBML class. 我尝试将类的生成操作从“内容”更改为“编译”,但是IntelliSense引发了很多关于找不到我的DBML类的错误。

Note DBML file, Class and aspx file are all in the same namespace. 注意 DBML文件,Class和aspx文件都在同一命名空间中。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Linq;

^ Imports on class that I'm trying to initialize. ^导入要尝试初始化的类。 (May be irrelevant) (可能无关紧要)

Any pointers in the right direction would be appreciated. 朝正确方向的任何指针将不胜感激。

You need to make sure that Build Action of none of the files in the App_Code folder is marked as Compile. 您需要确保将App_Code文件夹中所有文件的所有构建操作都标记为“编译”。

But this will bring its own side effects that intellisense may not work very well for these files inside VS as they will not be treated as Class files by VS… But the key point is that you do not really need “App_Code in Web Application Projects (WAP) if you do not intend to put random code files or modify existing code files in App_Code folder directly on your production server… 但这将带来其自身的副作用,即智能感知可能不适用于VS中的这些文件,因为它们不会被VS视为类文件。但是关键点在于,您实际上并不需要Web应用程序项目中的“ App_Code( WAP),如果您不想在生产服务器上直接放置随机代码文件或修改App_Code文件夹中的现有代码文件…

http://vishaljoshi.blogspot.fi/2009/07/appcode-folder-doesnt-work-with-web.html http://vishaljoshi.blogspot.fi/2009/07/appcode-folder-doesnt-work-with-web.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM