the type does not expose a method called - Domain Service Class Custom Method RRS feed

  • Question

  • My custom domain service class method is not being exposed to the client grid but i do not know why. the purpose for the custom function is to return the results of a join of two entities to a domaindatasource to bind to a grid. the following is a method added to the template generated domain service class:

            // CustomerPurchase is defined above - it simply holds data values from join row
            public IQueryable<CustomerPurchase> GetCustomerPurchases()
                var purchases = // linq to retrieve join set
                return purchases.AsQueryable<CustomerPurchase>();

    the xaml file does not see this method. does anyone know why?
    the template generated methods are exposed and work correctly.

    Tuesday, June 19, 2012 4:39 PM


  • there seem to be two problems. to fix them:

    1. annotate custom method as [Query]

    public IQueryable<CustomerPurchase> GetCustomerPurchases()

    2. annotate custom class (T) with [Key]

        public class CustomerPurchase
            public CustomerPurchase()
            public string Title { get; set; }
            // more code

    after rebuilding the solution, the error message disappeared and the grid populated with expected data.

    Tuesday, June 19, 2012 4:58 PM