Exposing SQL View via WCF Data Service

6 posts, 0 answers
  1. Neil Mercer
    Neil Mercer avatar
    18 posts
    Member since:
    Sep 2009

    Posted 22 Feb 2011 Link to this post


    I have a simple MSSQL database with 2 tables that I've exposed via a WCF Data Service using the DSW to create it.  This works fine.

    Now I've gone back to the database and created a SQL View.  I've added it to the rlinq model and its generated a class to represent it fine.  However, when I run DSW to re-create the WCF Data Service and expose the View, it doesn't appear in the list of available classes.

    How can I make this work?

  2. A.Alexandrov
    A.Alexandrov avatar
    25 posts

    Posted 24 Feb 2011 Link to this post

    Hello Neil Mercer,

    I am afraid that you will not be able to generate a data service for entities mapped to views, because generally CUD operations cannot be made against a view. That is why we filter all entities mapped to views. You can use entities mapped to tables instead.
    If any further questions arise, please do not hesitate to contact us.

    Best wishes,
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  3. DevCraft banner
  4. Tommy Reynolds
    Tommy Reynolds avatar
    3 posts
    Member since:
    Oct 2007

    Posted 11 Oct 2011 Link to this post

    I have the same issue.  The intent is not to use the CUD operations on a view but however to expose the View Class from the service for the client application.   Can you provide or offer a solution on how to accomplish this with the ORM tool. 

    Also, can you briefly explain using the ORM tool which generates the classes for the entities vs. using a TT template.  I'm confused on if these are meant to work together or use one method vs. the other.  My understanding has been to let the ORM tool generate from the db, the entities, classes and service. 

  5. A.Alexandrov
    A.Alexandrov avatar
    25 posts

    Posted 12 Oct 2011 Link to this post

    Hi Tommy,

    The Data Services Wizard at the moment does not support generation of service for entities mapped to views, although we are working on this and it will be supported in one of the future releases. For the time being you can manually add this missing functionality in the generated service class as a workaround.

    As for your other question, there is no direct connection between the Data Services Wizard and the Visual Designer. When you create a Domain Model (diagram in RLINQ file) by defining your entities in the designer or directly retrieving them from the database, the result is a list of classes that can be used with or without a service. Those classes are created based on TT templates different
    from those that are used for the services.

    Once a Domain Model is generated or created, you are able to expose your persistent classes through several types of services using the Data Services Wizard.

    Do not hesitate to contact us if you need any further clarifications.

    All the best,
    the Telerik team

    Check out the latest stable build of Telerik OpenAccess ORM. Download it and benefit from our new Project Templates.

  6. Eduardo
    Eduardo avatar
    9 posts
    Member since:
    Feb 2009

    Posted 25 Jan 2013 Link to this post

    Is this feature available now??  This thread is from 1 year ago.

    If the feature is not available? why i am able to select Views in the Data Services  wizard?
  7. Ivailo
    Ivailo avatar
    318 posts

    Posted 29 Jan 2013 Link to this post

    Hello Eduardo,

    During the past one year, the functionality available in OpenAccess ORM for generating services has been significantly enhanced. The Data Services Wizard is now deprecated, and we have developed a brand new Add OpenAccess Service wizard including many different capabilities.

    Take a look at this video, showing you how to generate WCF Data Services with the new wizard.

    Regarding the views, the Add OpenAccess Service wizard is capable of exposing them in a WCF Data Service but with two important conditions:
    1) Each view has to have a primary key defined in the model
    2) Only read operations are allowed on views

    For more information you can refer to this documentation section.

    Let us know if you have any additional questions.

    All the best,
    the Telerik team
    Q3'12 SP1 of OpenAccess ORM packs Multi-Table Entities mapping support. Check it out.
Back to Top
DevCraft banner