DataServiceDataSource with Linq To Sql

6 posts, 0 answers
  1. Joao Paulo Grassi
    Joao Paulo Grassi avatar
    98 posts
    Member since:
    Feb 2011

    Posted 07 May 2012 Link to this post

    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
  2. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 08 May 2012 Link to this post

    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 >>

  3. UI for WPF is Visual Studio 2017 Ready
  4. Joao Paulo Grassi
    Joao Paulo Grassi avatar
    98 posts
    Member since:
    Feb 2011

    Posted 08 May 2012 Link to this post

    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?
  5. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 08 May 2012 Link to this post

    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 >>

  6. Joao Paulo Grassi
    Joao Paulo Grassi avatar
    98 posts
    Member since:
    Feb 2011

    Posted 08 May 2012 Link to this post

    Yes, appears that's something is wrong with the connection string, but it is defined on app.config file. Attached the inner exception

    Thanks.
  7. Joao Paulo Grassi
    Joao Paulo Grassi avatar
    98 posts
    Member since:
    Feb 2011

    Posted 08 May 2012 Link to this post

    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.
Back to Top
UI for WPF is Visual Studio 2017 Ready