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

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

4 Answers 166 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Sandi Markon
Top achievements
Rank 1
Sandi Markon asked on 10 Nov 2010, 02:00 PM
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!

4 Answers, 1 is accepted

Sort by
0
Sandi Markon
Top achievements
Rank 1
answered on 10 Nov 2010, 02:34 PM
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
0
jacky
Top achievements
Rank 1
answered on 10 Jan 2011, 05:03 PM
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.
0
Dave Navarro
Top achievements
Rank 2
answered on 10 Mar 2013, 08:50 PM
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
0
Peter
Telerik team
answered on 13 Mar 2013, 09:39 AM
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.

Tags
General Discussions
Asked by
Sandi Markon
Top achievements
Rank 1
Answers by
Sandi Markon
Top achievements
Rank 1
jacky
Top achievements
Rank 1
Dave Navarro
Top achievements
Rank 2
Peter
Telerik team
Share this question
or