7

这里的所有开发计算机,但其中一台安装了 DotNET 4.5。最后一个安装了4.0。只有具有 4.0 的计算机会生成实现 INotifyPropertyChange 的代理类,所有其他计算机都不会。

根据 MSDN /edb 是支持的。 http://msdn.microsoft.com/en-us/library/aa347733(v=vs.110).aspx

我们使用的开关是: /o /ct /r / edb / n /noconfig /tcv

这是从 4.​​0 计算机生成的:

public partial class OrganizationEdition : MyCompany.MyProject.Client.Win.ServiceProxy.UpdateableEntity, System.ComponentModel.INotifyPropertyChanged
{

    private string CommentField;

    private System.DateTime ValidFromField;

    private System.Nullable<System.DateTime> ValidToField;

    [System.Runtime.Serialization.DataMemberAttribute()]
    public string Comment
    {
        get
        {
            return this.CommentField;
        }
        set
        {
            if ((object.Equals(this.CommentField, value) != true))
            {
                this.CommentField = value;
                this.RaisePropertyChanged("Comment");
            }
        }
    }

这是来自 4.5 计算机(使用 Windows SDK 7.0A):

public partial class OrganizationEdition : MyCompany.MyProject.Client.Win.ServiceProxy.UpdateableEntity
{

    private string CommentField;

    private System.DateTime ValidFromField;

    private System.Nullable<System.DateTime> ValidToField;

    [System.Runtime.Serialization.DataMemberAttribute()]
    public string Comment
    {
        get
        {
            return this.CommentField;
        }
        set
        {
            this.CommentField = value;
        }
    }
4

1 回答 1

2

I can't tell you why it is not working.

However I could give you a trick how to get around this. You could use .tt files (T4 templates) in order to restore missing notifications in property setters in particular classes existing in your solution at compile time.

An example of how to implement such functionality is avaliable here on Pluralsight and here on MSDN is more information about T4 templates syntax.

于 2013-11-19T13:15:30.337 回答