gpt4 book ai didi

c# - 安装 DotNET 4.5 时,SvcUtil/edb 不会生成 INotifyPropertyChange

转载 作者:太空狗 更新时间:2023-10-29 20:36:36 25 4
gpt4 key购买 nike

这里的所有开发计算机都安装了 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;
}
}

最佳答案

我不能告诉你为什么它不起作用。

但是我可以给你一个技巧来解决这个问题。您可以使用 .tt 文件(T4 模板)来恢复编译时解决方案中存在的特定类的属性 setter 中丢失的通知。

如何实现此类功能的示例可用 here on Pluralsighthere on MSDN是关于 T4 模板语法的更多信息。

关于c# - 安装 DotNET 4.5 时,SvcUtil/edb 不会生成 INotifyPropertyChange,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19981689/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com