WCF RIA with SignalR - wcf-ria-services

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.

Related

Always use EF with WCF or I could use EF directly in the clients?

I have an application that will connect to a Sql Server database that is installed in a server. The application will run in many client computers.
This application has a repository that uses EF to access to the database and has the logic bussiness related with the data of the database, check the information is correct, add, delete, modify and so on.
I am thinking that I have two main options.
First one, the client application, the application that will run in the client computers, can use this respository, so the application would can connect directly to the Sql Server database.
The second option, to have a server application that use this repository to connect to the databse. The clients will not use the repository, instead, will use WCF to connect with the server application to request actions and data to the database. The server would do all the work and send the result to the client through WCF.
If I am not wrong, WCF it is good when two applications has to communicate between them, for notify something between different applications or work together to do some work and so on. But in my case, it would be use just to access to the database, but the clients could do it directly if the use the repository. So I guess that use WCF to do that it would add a new layer that will make to have more work and I guess that comsume more resources.
However, this first option has a problem, if the repository has a bug and would make that the information of the databse it is incorrect or inconsistent, if I fix the problem, I would have to update all the clients to avoid they update the database incorrectly. But in some cases it would be very hard to ensure all the clients update the application to avoid the problem. At least, I don't know the way to force to a client can't run the application if it is detected a new version of the application. Are there any way to force this update?
The second option solve this problem, because I just to update the server application and all it is done. However, it makes the server to work more and need more resources. Also, I would add a new layer to the application, more work too.
So my question is, in this kind of applications, what is the best solution, first one, second one or another one that I don't know?
Is it possible to avoid that a client application runs if it is detected a new mandatory update? If it is possible, the first option would be a good solution, letting to the client applications access directly to the database?
Thanks so much.
From my point of view I would use ASP.NET WebApi 2 rather than WCF as with the first one you will be able to create a resource-oriented services over HTTP (RESTful) that can use the full features of HTTP (like URIs, request/response headers, caching, versioning, various content formats).
The idea would be to call your WebApi endpoints from the client application. In this way, all the code related to retrieve the information from your database would be defined in the API and it will be only accessible through the API.
Getting started with ASP.NET WebAPi 2: https://www.asp.net/web-api/overview/getting-started-with-aspnet-web-api/tutorial-your-first-web-api

Want to move from web services to Web API. How to go about this?

So right now our company has custom SOAP web services that hold functions to do things (e.g. sending emails, getting employee info, etc.) and are connected via Service References.
We want to make the switch to Web API 2, but I'm kind of lost on how we can (or if it's possible) to do that since all of our services interact with SOAP.
I wanted to create brand new Web APIs for each service we have which would hold the methods, but I'm not sure where to start. I've scoured the internet, but I haven't really found anything that answers my question.
Can someone shed some light on this for me? Thanks
well, you can create the Web API Service, and exposes the functions that you need, maybe, this service can be accessed from anywhere, but, the real functionality is on the soap (that can be in a DMZ for example), so, create a class library that consume those services and Web API now use this class library, so Web API will be only a facade.
But, first think, is really necessary have this facade in web api to consume those services?
Remember that if your soap services are built with WCF, WCF has support for HTTP protocol.

posting image from iphone app to restful WCF

I need to post image from ios app to .net 4 restful WCF service. Can someone help with following codes together (as a working package),
on .NET side: Interface code, Service code (implemenation) and web.config XML.
on IOS side: the posing to the wcf part.
although there seem to be several sources online about how to achieve this, after long time messing with it, still can't get it going.
Thanks a lot!
For the server side: take the input as a Stream - that way you can receive arbitrary data (including images). More information in this blog post. For the client side: take a look at the NSURLRequest class - if you search for examples, you'll find many, including here from StackOverflow.
Just send the image as byte array to the wcf service and store it as blob in SQL server if you need to store.

Dealing with WCF in iPhone/iPad project

I'm trying to make my Monotouch app work with WCF service. Everything works fine but every now and then (10 - 30 service calls), app crashes with SIGIL. Debugger says just that.
It happens on random places.
Another employee works on iPhone app which uses same service. Same problem, but more frequent.
Everything works great when testing on simulator.
If somebody's had same problem, please help. Would using asmx service help?
Thank you all.
Cheers
WCF is a bloated option on high traffic servers at the best of days, using SOAP in a mobile application is a enough of a waste of resources that it should be considered bad practice.
ServiceStack is a much leaner and faster option that also allows you to access your same web services with ServiceStack's strong-typed, code-gen-free Service Client's using .NET's fastest JSON and JSV Text serializers.
The MonoTouch versions of ServiceStack's service clients is available separately from:
https://github.com/ServiceStack/ServiceStack/tree/master/release/latest/MonoTouch
And an example MonoTouch application that showing how to use is available here:
https://github.com/ServiceStack/ServiceStack.Examples/tree/master/src/MonoTouch/RestFilesClient
Not much an answer, but I had a similar issue. Worked for a long time to get my desktop WCF client code running on MonoTouch, only to have the app die after 10 or so calls on SIGIL.
Symbolicating and analysing the crash reports showed the app dying somewhere in the WCF stack every time. However I could not distill the issue down into a trivial, reproducable example.
In the end I used the ServiceStack framework (http://www.servicestack.net/) to throw a simple XML REST endpoint in front of my service, and called it using simple WebClient requests and some helper methods to push my objects to/from XML (DataContractSerializer was too slow).
If you have access to the server side, this may be your simplest approach.

Example for using WCF RIA Services with Prism?

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.