Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/linq/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 智能感知不';不显示部分类方法_C#_Linq_Intellisense - Fatal编程技术网

C# 智能感知不';不显示部分类方法

C# 智能感知不';不显示部分类方法,c#,linq,intellisense,C#,Linq,Intellisense,我有LINQtoSQL生成的部分类User,如下所示: [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.[User]")] public partial class User : INotifyPropertyChanging, INotifyPropertyChanged { private static PropertyChangingEventArgs emptyChangingEventArgs =

我有LINQtoSQL生成的部分类User,如下所示:

    [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.[User]")]
public partial class User : INotifyPropertyChanging, INotifyPropertyChanged
{

    private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
 ...
然后,我在项目中创建了单独的文件夹“Proxy”,并在其中添加了一个用户类:

namespace LINQtoSQL_sample.Proxy
{
    public partial class User
    {
        public static string GetActivationUrl()
        {
            return Guid.NewGuid().ToString("N");
         ...
当我试图从同一项目的另一部分调用那个额外的静态方法时,问题就发生了。假设我还有一个文件夹“SqlRepositoryImpl”和另一个分部类:

namespace LINQtoSQL_sample.SqlRepositoryImpl
{
    public partial class SqlRepository
    {
        public bool CreateUser(User instance)
        {
            if (instance.ID == 0)
            {
                instance.added_date = DateTime.Now;
                instance.activated_link = LINQtoSQL_sample.Proxy.User.GetActivationUrl();
              ...
正如您所看到的,我明确定义了我调用的用户类的哪一部分,因为IntelliSense没有建议我使用额外的方法

请告诉我为什么会这样,我错在哪里

正如您所看到的,我明确定义了我调用的用户类的哪一部分,因为IntelliSense没有建议我使用额外的方法

当你从一个类中调用一个方法时,这个类就不再有“部分”了


如果需要(并且可以)指定类的完整命名空间以从中调用方法,这意味着您实际上在两个不同的命名空间中有两个不同的类。如果两个
partial
声明位于不同的命名空间中,那么实际上您已经声明了两个独立的类,而不是两个部分中的单个类。

确保两个partial用户类位于同一命名空间中