Custom Method

May 8, 2009 at 4:22 PM


I am using  LINQ to SQL mold. 

Can anyone tell me how custom methods are working for Entities. 

I have a entity named ProductType with following fields.

       ProductTypeID, Value, Code.

I want to create a custom method in ProductType entity named GetByCode. 

I tried to create the methods, but having some issue with it.

1) I want to return List<ProductType> from the GetByCode method. How do I do it?

2) If I set return type integer, the code generator has generated a method named GetByCode in ProductTypeRepositoryBase  class. But this method is not marked as Virtual.

So, how do I create CustomMethods as Virtual ?