LINQ-to-SQL类没有实现INotifyPropertyChanging&如果从本地数据库中提取INotifyPropertyChanged [英] LINQ-to-SQL class doesn't implement INotifyPropertyChanging & INotifyPropertyChanged if pulling from local database

查看:112
本文介绍了LINQ-to-SQL类没有实现INotifyPropertyChanging&如果从本地数据库中提取INotifyPropertyChanged的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在LINQ-to-SQL类中修改了我的数据源(通过旧的删除并拖回方法),并且很惊讶地看到了INotifyPropertyChanging& INotifyPropertyChanged接口不再在生成的类中实现(MyDb.designer.cs)。

I modified my data source in my LINQ-to-SQL class (by the old delete and drag back in method), and was surprised to see the INotifyPropertyChanging & INotifyPropertyChanged interfaces no longer implemented in the generated classes (MyDb.designer.cs).

各个字段的方法看起来像这样......

The methods for the individual fields went from looking like this...

[Column(Storage="_Size", DbType="NVarChar(100)")]
public string Size
{
    get
    {
        return this._Size;
    }
    set
    {
        if ((this._Size != value))
        {
            this.OnSizeChanging(value);
            this.SendPropertyChanging();
            this._Size = value;
            this.SendPropertyChanged("Size");
            this.OnSizeChanged();
        }
    }
}

看起来像这样.. 。

[Column(Storage="_Size", DbType="NVarChar(100)")]
public string Size
{
    get
    {
        return this._Size;
    }
    set
    {
        if ((this._Size != value))
        {
            this._Size = value;
        }
    }
}

关于为什么会发生这种情况的任何想法以及它将如何影响我的申请?

Any ideas on why this happens and how it will affect my application?

推荐答案

确保你的桌子有一把主钥匙。

Make sure your table has a primary key.

这篇关于LINQ-to-SQL类没有实现INotifyPropertyChanging&如果从本地数据库中提取INotifyPropertyChanged的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆