EntityDataSource Wizard - an object context member doesn't show?

5 posts, 0 answers
  1. Sandi Markon
    Sandi Markon avatar
    101 posts
    Member since:
    Jul 2012

    Posted 10 Nov 2010 Link to this post

    Hello,

    I'm trying to connect EntityDataSource Wizard with existing ObjectContext but a method that executes data retrieval doesn't show on Object Context members list. Method GetProducts looks like this:

         [EnableClientAccess]
        public class AdventureWorksDomainService : LinqToEntitiesDomainService<AdventureWorksEntities>
        {
            public IQueryable<Product> GetProducts(string name)
            {
                return ObjectContext.Products.Include("ProductModel").Where(w => w.Name.Contains(name));
            }
        }

    Complete solution is rebuilded successfuly. Why there is no GetProducts method on the Object Context members list?

    Any help appreciated!
  2. Sandi Markon
    Sandi Markon avatar
    101 posts
    Member since:
    Jul 2012

    Posted 10 Nov 2010 Link to this post

    Solved! I must create partial class which extends entities context that defines new object context member (method), like this:

    partial class AdventureWorksEntities
    {
        public List<Product> GetProducts(string name)
        {
            return this.Products.Include("ProductModel").Where(w => w.Name.Contains(name)).ToList();
        }
    }

    Everything is described in this document: Connecting to an Entity Data Model with the EntityDataSource component, now the new method GetProducts shows in EntityDataSource Wizard. I'm happy! :)

    Best Regards
  3. DevCraft banner
  4. jacky
    jacky avatar
    1 posts
    Member since:
    Jan 2011

    Posted 10 Jan 2011 Link to this post

    Hello, I'm facing the same problem, and I tried to create the partial class, but failed to do so.
    Could you please tell me where this class should be created.
  5. Dave Navarro
    Dave Navarro avatar
    150 posts
    Member since:
    Jul 2005

    Posted 10 Mar 2013 Link to this post

    Hello,

    I'm having similar troubles but I'm using the Standalone version of the Reporting Tool for a Silverlight 5 project.

    Does anyone know if this solution should work for users that are working with the Standalone Reporting Tool?

    Also, some of our users don't have Visual Studio installed. They're creating reports and need access to the data.

    Please let me know and thanks!

    ~ Dave
  6. Peter
    Admin
    Peter avatar
    1611 posts

    Posted 13 Mar 2013 Link to this post

    Hello,

    Jacky, you should create a partial class for the EF context. You may find useful the Connecting to an Entity Data Model with the EntityDataSource component.

    Dave, in order to utilize the EF models in the standalone Report Designer you have to extend the designer as elaborated in Extending Report Designer help article.

    All the best,
    Peter
    the Telerik team

    Telerik Reporting Q1 2013 available for download with impressive new visualizations. Download today from your account.

Back to Top
DevCraft banner