zoukankan      html  css  js  c++  java
  • 《Scott Mitchell 的ASP.NET 2.0数据教程》之二 BLL层 学习过程中的问题

    前几日有学员反映按照《Scott Mitchell 的ASP.NET 2.0数据教程之二》中的例子仿写,结果无法运行程序,报错误,找不到名为"NorithwindTableAdapters"的命名空间,导致程序无法运行。
    出错信息为:“错误 1 找不到类型或命名空间名称“NorithwindTableAdapters”(是否缺少 using 指令或程序集引用?) D:\Code\Northwind\Web\App_Code\BLL\Categories.cs 10 7 D:\...\Web\
    ”。
    遇到这种问题可以通过GOOGLE搜索,得到想要的答案,老外是这样回答的(参见http://forums.asp.net/t/1010504.aspx):
     I was able to fix this, though I still don't understand why it happens.

    As Mr. Freeman (great job against the Xen, by the way) mentioned, the namespace is auto-generated by VS.Net. You can find out what namespace it created by opening the Class View and looking for the namespace objects (they look like braces: {}), in my case:
    namespace NorthwindsTableAdapters;
    Notice the bold "s"? Changing the code to this namespace worked. Why VS did this I have no idea, neither VS nor the tutorial gives any indication where this name comes from.

    I typed the code in myself rather than downloading it; I find I don't learn anything by downloading and running samples.
    意思就是说:请打开你VS.NET 2005的“类视图”窗口,查找你的命名空间究竟为什么,注意这里的命名空间应该是带"S"的命名,然后在程序中引用即可。

    另外,其中用到了设计模式的“单件”模式,不清楚的同学请Google相关资料。
  • 相关阅读:
    Centos Another app is currently holding the yum lock
    Centos 重置密码
    Effective c#学习笔记(1)
    浅谈计算机编码
    mongodb java spring data
    VS2013 好用的插件
    xml存储bug
    VS 2008 生成操作中各个选项的差别
    程序权限控制
    给钛度产品的一些建议(Note)
  • 原文地址:https://www.cnblogs.com/koon/p/1071769.html
Copyright © 2011-2022 走看看