C# SQLMetal 生成的代码
嘿,SQLMetal 生成如下代码:
[Column(Storage = "_specimen", DbType = "VarChar(100)")]
public string Specimen
{
get
{
return this._specimen;
}
set
{
if ((this._specimen != value))
{
this.OnSpecimenChanging(value);
this.SendPropertyChanging();
this._specimen = value;
this.SendPropertyChanged("specimen");
this.OnSpecimenChanged();
}
}
}
OnSpecimenChanging
以及所有这些方法的作用是什么? this.SendPropertyChanged("specimen");
中的样本是否必须全部大写或者不区分大小写?
Hei, SQLMetal generates code like this:
[Column(Storage = "_specimen", DbType = "VarChar(100)")]
public string Specimen
{
get
{
return this._specimen;
}
set
{
if ((this._specimen != value))
{
this.OnSpecimenChanging(value);
this.SendPropertyChanging();
this._specimen = value;
this.SendPropertyChanged("specimen");
this.OnSpecimenChanged();
}
}
}
What are the OnSpecimenChanging
and all those methods do? And does the specimen from thethis.SendPropertyChanged("specimen");
has to be allso capitalized or its not case sensitive?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果没有看到任何源代码,很难说他们到底做了什么。 SendPropertyChanged 最有可能用于引发 PropertyChanged 事件,该事件将通知该事件的任何订阅者特定属性已更改。 PropertyChangedEventArgs 中的 PropertyName 字符串区分大小写,因此 S 需要大写。
有关详细信息:
http://msdn.microsoft.com/en -us/library/system.componentmodel.inotifypropertychanged.aspx
http://msdn.microsoft.com/en-us/library/system .componentmodel.inotifypropertychanging.aspx
It's hard to say what they do exactly without seeing any source code. SendPropertyChanged is most likely used to raise the PropertyChanged event, which will notify any subscribers to the event that a particular property has changed. The PropertyName string in PropertyChangedEventArgs is case sensitive, so the S will need to be capitalised.
For more information:
http://msdn.microsoft.com/en-us/library/system.componentmodel.inotifypropertychanged.aspx
http://msdn.microsoft.com/en-us/library/system.componentmodel.inotifypropertychanging.aspx