Cannot add method to "Customer" class

2 posts, 0 answers
  1. Dan
    Dan avatar
    6 posts
    Member since:
    Sep 2013

    Posted 17 Mar 2014 Link to this post

    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..?
  2. Kristian Nikolov
    Admin
    Kristian Nikolov avatar
    206 posts

    Posted 20 Mar 2014 Link to this post

    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.
     
  3. DevCraft banner
Back to Top