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
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.
A.Alexandrov
the Telerik team
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.
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.
A.Alexandrov
the Telerik team
Check out the latest stable build of Telerik OpenAccess ORM. Download it and benefit from our new Project Templates.
If the feature is not available? why i am able to select Views in the Data Services wizard?
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.
Ivailo
the Telerik team