If column allow does not allow NULL in db then a condition in setter of generated property in Entity Framework is if (_ColumnName != value
)
What is the use of this?
Why this condition is missing in setter generated from columns which allow NULL?
[EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
[DataMemberAttribute()]
public global::System.String Address1
{
get
{
return _Address1;
}
set
{
if (_Address1 != value) // This condition is only for columns which are not null in db. Why this is not needed for nullable columns.
{
OnAddress1Changing(value);
ReportPropertyChanging("Address1");
_Address1 = StructuralObject.SetValidValue(value, false);
ReportPropertyChanged("Address1");
OnAddress1Changed();
}
}
}
private global::System.String _Address1;
[EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
[DataMemberAttribute()]
public global::System.String Address2
{
get
{
return _Address2;
}
set
{
// NO IF CONDITION HERE LIKE IT IS IN PROPERTY WHICH DON'T ALLOW NULL (ABOVE PROPERTY ADDRESS1)
OnAddress2Changing(value);
ReportPropertyChanging("Address2");
_Address2 = StructuralObject.SetValidValue(value, true);
ReportPropertyChanged("Address2");
OnAddress2Changed();
}
}
private global::System.String _Address2;