So, I\'m importing data from one database into another. There are about 5,000 records (so nothing ridiculous, but not small enough to eyeball). Is there an easy way to autom
Linq2Sql will generate a property like this:
[Column(Storage="_Name", DbType="NVarChar(50) NOT NULL")]
public string Name
{
get
{
return this._Name;
}
set
{
if ((this._Name != value))
{
this.OnNameChanging(value);
this.SendPropertyChanging();
this._Name = value;
this.SendPropertyChanged("Name");
this.OnNameChanged();
}
}
}
See how it calls a function called OnNameChanged
? Just create a function with that name to do the truncation and logging:
void OnNameChanged()
{
if (Name.Length > 50)
{
Name = Name.Substring(0, 50);
LogSomehow("Name truncated");
}
}