views:

68

answers:

2

Hello,

I am trying to add validation logic into my application. I have tried to follow this tutorial http://www.a2zdotnet.com/View.aspx?id=75

but I do not have any
partial void OnEmailIdChanging(string value) or any "changing" functions. in my class, so I get an error from Visual Studio. It seems that VS did not generate enough code when I have created the dbml file...

Any ideas ?

Thank you!

+1  A: 

Check this for partial class definition. I didn't download source (cause it asked to log in), but i`m sure that tutorial is about extending linq2sql data context with custom partial class.

namespace fooo
{

//In your case - generated linq2sql data context
public partial class foo
{
    event EmailIdChangingHandler OnEmailIdChanging;
}

//Yours partial class, which extends data context
public partial class foo
{
    public foo()
    {
        OnEmailIdChanging += doSomethingOnEmailChanging;
    }

    public void doSomethingOnEmailChanging()
    {
        Console.WriteLine("email changed");
    }
}
}

And make sure your database has column EmailId.

Arnis L.
+1  A: 

I have found the solution. I was because I did not set correctly a primary key on the table !

Then check yours answer as accepted for some clarity.
Arnis L.