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

DataServiceDataSource with Linq To Sql

5 Answers 112 Views
DataServiceDataSource
This is a migrated thread and some comments may be shown as answers.
Missing User
Missing User asked on 07 May 2012, 07:32 PM
Hello!

We already set up a silverlight project using the DataServiceDataSource. But now, we have a project in WPF, and we are trying to implement the same scenario, but in this WPF project we are using Linq to SQL (.dbml) to generate the models.

This is a short description of the project structure:

APP (Views, ViewModels) WPF Application
Core(.dbml, partial classes, business logic etc) c# class library
Service(WCF for something that the project might have) WCF

My question is, with this architecture, how do i use the DataServiceDataSource? I realy need a service exposed to use it? it would be great if you explain it a little bit.

Looking forward to a answer.

Thanks

5 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 08 May 2012, 06:44 AM
Hi,

 RadDataServiceDataSource is designed to work with OData/WCF Data services. For your case I suggest you to use EF instead LinqToSql if you want direct data-base access and in this case you can use RadEntityFrameworkDataSource.

Greetings,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Missing User
answered on 08 May 2012, 01:10 PM
Oh that's good news!

I follow the documentation, and add a Entity Model, like this:

<telerik:RadEntityFrameworkDataSource Name="PessoasEntityDataSource"
                                      QueryName="VW_PESSOA">
   <telerik:RadEntityFrameworkDataSource.ObjectContext>
         <core:ITS_CARTEntities />
   </telerik:RadEntityFrameworkDataSource.ObjectContext>
</telerik:RadEntityFrameworkDataSource>

But when i start the project, i'm getting this error:

'The invocation of the constructor on type 'Telerik.Windows.Controls.RadEntityFrameworkDataSource' that matches the specified binding constraints threw an exception.'.

Am I missing something?
0
Vlad
Telerik team
answered on 08 May 2012, 01:13 PM
Hi,

 Can you check the inner exception? 

Regards,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Missing User
answered on 08 May 2012, 01:31 PM
Yes, appears that's something is wrong with the connection string, but it is defined on app.config file. Attached the inner exception

Thanks.
0
Missing User
answered on 08 May 2012, 02:01 PM
I've found the problem, my .edmx is in a different project, so I copy the connection string to the configuration file of the WPF project, now it works. Is this the right way? I mean, it seems to me a little bit strange define the same connection string in two projects.
Tags
DataServiceDataSource
Asked by
Missing User
Answers by
Vlad
Telerik team
Missing User
Share this question
or