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

Exposing SQL View via WCF Data Service

5 Answers 170 Views
Web Services
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Neil Mercer
Top achievements
Rank 1
Neil Mercer asked on 22 Feb 2011, 06:20 AM
Hi,

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?

Thanks,
Neil.

5 Answers, 1 is accepted

Sort by
0
A.Alexandrov
Telerik team
answered on 24 Feb 2011, 08:49 AM
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,
A.Alexandrov
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!
0
Tommy Reynolds
Top achievements
Rank 1
answered on 11 Oct 2011, 09:43 PM
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. 


0
A.Alexandrov
Telerik team
answered on 12 Oct 2011, 08:24 AM
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,
A.Alexandrov
the Telerik team

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

0
Eduardo
Top achievements
Rank 1
answered on 25 Jan 2013, 05:17 PM
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?
0
Ivailo
Telerik team
answered on 29 Jan 2013, 09:31 AM
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,
Ivailo
the Telerik team
Q3'12 SP1 of OpenAccess ORM packs Multi-Table Entities mapping support. Check it out.
Tags
Web Services
Asked by
Neil Mercer
Top achievements
Rank 1
Answers by
A.Alexandrov
Telerik team
Tommy Reynolds
Top achievements
Rank 1
Eduardo
Top achievements
Rank 1
Ivailo
Telerik team
Share this question
or