This is a migrated thread and some comments may be shown as answers.

Cannot add method to "Customer" class

1 Answer 33 Views
Data Access Free Edition
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Dan
Top achievements
Rank 1
Dan asked on 17 Mar 2014, 10:33 PM
I am playing around with the ORM and I'm trying to add a custom method to the service, but whatever I do, the client just cannot see it.

I am using the WfcRiaDemo video from here: http://tv.telerik.com/watch/openaccess-orm/exposing-openaccess-orm-models-using-wcf-ria-services

I tried to add a custom method to the Customer table, by following these instructions ( http://docs.telerik.com/data-access/developers-guide/data-access-domain-model/model-definition-basics/data-access-tasks-working-with-objects-implement-business-logic-entites ), but no matter what I do I cannot get it to show up in the client.

My partial Customer class looks like this:

namespace WcfRiaDemo.Web
{
    public partial class Customer
    {
        public string CustName()
        {
            return "name";
        }

        public int Number10
        {
            get { return 10; }
        }
    }
}

Curiously, the Number10 property shows up just fine in the silverlight app.

Does anyone have any idea why this might be..?

1 Answer, 1 is accepted

Sort by
0
Kristian Nikolov
Telerik team
answered on 20 Mar 2014, 10:01 AM
Hi Dan,

The behavior you are experiencing is expected. In order to add a custom method to the proxy classes on the client side, you would have to extend the proxy classes themselves. This is done again with defining a partial class with the same name and namespace as the one you wish to extend but in another code file. Please refer to this documentation article, under the Implementing Partial Methods segment, which describes the process.

I hope this helps. Should you have additional questions or need assistance, feel free to post at our forums again.

Regards,
Kristian Nikolov
Telerik
 
OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
 
Tags
Data Access Free Edition
Asked by
Dan
Top achievements
Rank 1
Answers by
Kristian Nikolov
Telerik team
Share this question
or