Example for using WCF RIA Services with Prism? - wcf-ria-services

Is there a current and good example how to use WCF RIA Services together with Prism? There's a lot of information about each topic. But at the moment I can't see how to put everything together into a "real world" LOB application.

You can check the Telerik Sales Dashboard demo. It implements the "Composite Application Guidance for WPF and Silverlight ("Prism")" and also uses WCF Services. You can download the source of the application and run it on your side.

Related

Client application that can access SQL Server via OData or directly via an Entity Framework SQL Connection

My application currently accesses SQL Server the "traditional" way - via EntityConnection on top of SqlClient. I would like to add the option of accessing SQL Server via a new OData service. Any ideas on the best way to do this? Is it possible to reuse the existing model-first EntityObject-derived classes? Thanks!
The best way would be to follow this tutorial to create an OData service: http://www.asp.net/web-api/overview/odata-support-in-aspnet-web-api/odata-v4/create-an-odata-v4-endpoint.
Update adding more details given the comment:
Although the link should be enough for answering the question, I can also elaborate on the end-to-end scenario a little bit.
Now the premium experience of creating an OData V4 service out of an SQL Server DB is to use the ASP.NET Web API 2.2 for OData V4. With the help of the code-first aspect of entity framework you can create an OData V4 service that supports pagination, queries, and CRUD operations in a very reasonable time (about 10 minutes for every table in your database).
As soon as the service is created, various client libraries that supports consuming V4 services can be at your service. The premium experience on the .NET platform is the OData v4 Client Code Generator.
If your consumer is a non-developer, Power Query can help you import the data from the OData service. Their support for V4 services will come early next year according to this, but Excel and Power Pivot already natively support consuming V1-3 services. For creating a V1-3 service, the tutorial next to the one I gave at first would help.

OpenUI5 with Java Services

I am exploring OpenUI5 to use it as front end for developing SAP applications. One thing I noticed is that it is more user friendly with OData services/OData model. I believe, it may be a close initiative of Microsoft with SAP or vice-versa.
I am using Java technology along with JCo outside SAP environment. I am exploring for the best options.
Should I expose my Java services as OData services to leverage OpenUI5 capabilities?
1 I see that Java implementations for OData support is limited to Version 2 and Version 4 is underway. This community is very small, not surprisingly.
Should I limit the usage of OpenUI5 only for: application definitions, view definitions, layouts, etc. and use Java services (e.g. REST/SOAP)?
1 Here, I have to add my JavaScript/jQuery logic for the CRUD operations on UI controls. I am not sure how much of it is supported for plain JSON/XML objects if I push JSON/XML response from server.
Just to be clear, I hope you have a clear understanding of Odata and REST. The difference is that OData is a specific protocol; REST is architecture style and design pattern.
The OData protocol is built on top of the AtomPub protocol. The AtomPub protocol is one of the best examples of REST API design. So, in a sense you are right - the OData is just another REST API and each OData implementation is a REST-ful web service.
Odata is the way to go since with Odata Model & binding, the pain of writing a lot of javascript is reduced by a huge proportion.
I think you should keep it simple and use REST API and Json to communicate between your back end and SAPUI5 front end.

WCF RIA with SignalR

I am looking for a sample program with WCF RIA with SignalR.
I have a Silverlight 5 application which uses WCF Ria as the backend.
We have a requirement in which when a user saves some changes to a screen, all other users connected to the server should get a notification.
Thanks for your help in advance !
I found this sample for you. some of the statements are outdated because SignalR is constantly changing, but I'm sure this sample can help you.
What you actually need is to create SignalR server side code which can sample the changes which were done via the WCF RIA, so you will need to create some centralized access to data (if you don't already have one), once you got it, you just need to use the Silverlight SignalR client to connect it to the pushing mechanism.

Why is RIA services known as black magic?

Why do people call RIA services a black magic? What kind of black magic do they refer to ? Also, i have seen most people do not use RIA even though they are in Silverlight world. Why is it so? Even on stackoverflow, the % of people asking as well as answering to RIA services question is very very low. Why is it so?
WCF RIA Services provides the following benefits:
Makes a WCF RIA service that supports IQueryable and IEnumerable; WCF RIA Services creates client-side proxy which allows you to send only expression trees over the wire from the client in order to get back just the data you need. For example: you can call a method in your ria service called GetProducts() but also add a LINQ lambda such as GetProducts().Where( d => d.Quantity > 50 ) and only the expression is sent over the wire to the server. The server does the filtering and returns just the matches as strongly typed objects.
Dynamic generation of OData, REST/JSON, and SOAP endpoints with little more than a single line per endpoint in your web.Config.
Ability to automatically flow business rules created at the middle tier into the client tier
Allows you to efficiently flow validations from the middle tier to the user
Allows property, parameter, method, object, collection, and changeset level business rules through simple data annotation validator decoration
There are some deficiencies:
Still does not support WS-* (will in 5) for RPC
OData provider is not queryable
Well, I have not yet heard of people referring to WCF RIA Services as black magic.
I believe there is a small number of people using it (compared to the number of people writing stuff in Silverlight), because it is younger. People may have been developing their Silverlight applications for some time now (version 3.0 came out in July 2009) using classic WCF Services.
WCR RIA Services is still new (version 1.0 came out in May 2010, the final SP1 in December 2010) and we all know the rule, "Never change a running system", so if someone already has a working WCF webservice, why change it? In my case, we experimented with Silverlight and WCF some time ago and decided to wait. When RIA Services came out we thought that was great and started working on a Silverlight version of our main application. It is much easier using RIA Services in a new project than chaning your webservice access in an existing one.
In addition to that it should be noted that Silverlight is not limited to business applications with database access using a webservice. Therefore there may be quite a few Silverlight developers who do not need any kind of webservice.
Another reason might be the fact that for web applications requiring a database other technologies like ASP.NET, ASP.NET MVC, even PHP or JSP (and possibly others I may not even have heard of) have existed for quite a while. And although business applications ought to look nice, too, it usually is not the top requirement to have all kinds of fancy graphics and animations, etc.
Finally, why are so few questions regarding RIA Services asked on SO? Well, they do have their own forum which seems to be quite active. (I use it as a resource when looking for answers but don't post there.)
Regarding the "black magic" part of your question, I believe it is the ongoing shift to convention over configuration. Compared to vanilla WCF, you end up writing very little code to build the client-server relationship. Also, the WCF RIA tooling does a substantial amount of code generation to achieve this.
More on convention over configuration on specifically with WCF RIA and generally at Wikipedia.

LightSwitch vs WCF RIA

I've just found out about Visual Studio LightSwitch, Microsoft's new Silverlight-centric RAD tool.
Does this occupy the same space as WCF RIA Services?
Is WCF RIA effectively dead?
I've been doing some reading, and it seems that LightSwitch actually builds on top of RIA. I saw the following in a review in The Register -
Database connectivity and user
authentication in LightSwitch uses WCF
RIA Services, Microsoft's web service
framework for Silverlight, though
developers are shielded from the
details. This means there is a middle
tier running on Microsoft's IIS web
server.
Lightswitch does not make RIA Services obsolute. They are both valuable but are aimed at different audiences. RIA Services is aimed at professional programmers that want a high degree of control. Lightswitch is aimed at non-professional programmers. You can think of it as a Microsoft Access for building Silverlight applications.
I don't know where you found that quote "LightSwitch is targeted at professional developers and power users looking to create custom LOB applications", but that's NOT what LightSwitch was intended for at all. Power users, yes, professional developers, no.
LightSwitch is targeted at the non-developer, the type of user who creates "departmental" apps, who would perhaps currently use Excel, or Access. Though a number of professional developers (myself included) have recognised that LS is a fantastic tool for us to use as well, we were NOT the target audience at all.
As for RIA services being dead? Not at all! In fact RIA services is one of the main ways of accessing data that LS currently has trouble with (aggregation, projected entities etc). Using RIA services in LightSwitch is VERY easy. We're hoping, with the interest expressed by developers, that things will improve in that direction in future versions.
I agree with Phil, I tend to think of LS as Access.NET, even though it's far more than just that. Think of "forms over data" with all the latest technologies. Silverlight (both in browser & desktop), MEF, Entity Framework, RIA services etc.
Yann