LINQ Custom Entity Object Validation

M

Mike P

I am working through this tutorial :

http://weblogs.asp.net/scottgu/archive/2007/07/11/linq-to-sql-part-4-upd
ating-our-database.aspx

and trying to get this code to work :

using System;

public partial class Order
{
partial void OnValidate()
{
if (RequiredDate < OrderDate)
{
throw new Exception("Deliver date is before order date!");
}
}
}

But I am getting this error :

No defining declaration found for implementing declaration of partial
method 'Order.OnValidate()'

Can anybody help with this?
 
M

Marc Gravell

It looks like the designer now generates:

partial void OnValidate(System.Data.Linq.ChangeAction action);

so you need to add this argument for it to work. Alternatively, if you
type "partial" (and hit space) intellisense should prompt the available
options and create the stub for you.

Marc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top