Just comment your partial class customer and do the followings and should work
1.Go to your *.dbml file
2.Right click on the "customer" class and select "View Code" and put your partial validation class there, following is the sample validation i have tried
namespace CSUTOMER_PHONE_NUMBER
{
partial class Customer
{
partial void OnPhoneChanging(string value)
{
if (value.Length ==1)
throw new System.Exception ("not valid");
}
}
}
and when you set the value for the phone number it works
try
{
DataClasses1DataContext db = new DataClasses1DataContext();
Customer mycustumer = db.Customers.Single(c => c.CompanyName == "B's Beverages");
mycustumer.Phone = "1";
db.SubmitChanges();
MessageBox.Show("OK");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
Hope this helps