且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Linq to SQL DataContext生命周期管理问题

更新时间:2023-01-25 17:38:28

与部分DataContext类一起进入代码文件,并将using语句移至名称空间.出于某种原因,除非是这种情况,否则该工具将无法生成设计器.

Go into the code file with your partial DataContext class and move your using statements into your namespace. For some reason the tool will not generate the designer unless this is the case.

namespace MyNamespace
{
    using System;
    using System.Data.Linq;
    using System.Data.Linq.Mapping;
    using System.Reflection;
    using System.Xml.Linq;

    partial class DataContext
    {
    }
}

我相信从VS2008迁移到VS2008 SP1时需要进行此更改,尽管我可能会混淆一些版本.

I believe this change was required when moving from VS2008 to VS2008 SP1, though I may be mixing up some versions.