Is RIA Services right for our Silverlight app at this point? - silverlight

I'm looking at Silverlight architectures and RIA Services looks interesting, but I am a bit concerned about its prelease status and how the feature set will change.
We need our client app to be as responsive as possible over a slow network link, so a high priority is a solid sync system for pushing model state changes from the client back to the server. Will RIA Services help us in this regard or will I have to roll my own logic to do this ? Are there any other frameworks that can assist with this? Is the feature set involved in these requirements liable to change much in the next couple of months?
If it makes any difference, our frontend is 100% Silverlight, so we dont need to worry about exposing SOAP APIs from the server or anything like that. It appears to me that RIA so far is a bit more mature for Silverlight use. Is this correct?

I am using SL 3, .NET RIA and EF. Still trying to figure out how to load, and update data effectively and best in performance. Little information that I have so far how to improve the performance issue that I face. Still need more time to get these frameworks to be mature. Hopefully, there are more resources and insight in the near future.
My take is if you are handling very light data application, silverlight can be a good choice. Once you have loaded the application in to your machine, it is like loading application within your box.

I would look into some of the ORM's / IoC Frameworks which help create a separation of interests. A couple examples are Castle Windsor IoC, they have a sample Silverlight 4 application that utilizes the Castle Windsor Framework. Another common ORM for Silverlight is
BL Toolkit. These have been around for a while in the Java arena but are newer in the .NET area. They basically help to move the complexities of the relational data model out of the UI code and delegate it to the Framework.

Related

WPF vs Silverlight OOB with WCF RIA Services

I know there are other issues involved in any decission when beginning a large project, but my experience in the past has been with SL web based apps (w/ entity framework) where I have found wcf ria services such a time saver, I am wondering what people think about the reasons one might remain with wpf for desktop apps where so much more effort must be expended to match what the ria services provide in SL. This project is definitely a data-centric business app.
Any and all oversvations and experiences would be most welcome.
Thanks,
Steve
I may have some insight on your situation, since I am faced with making the same decision right now. I wrote up a blog post about my experience here:
http://samuelmueller.com/2010/11/wpf-4-vs-silverlight-4-which-do-you-choose
To summarize, WPF has one very big advantage over silverlight, especially with data-centric apps:
Performance.
With that being said, the list of negatives is quite daunting, and really makes WPF a hard sell over Silverlight:
No support for WCF RIA Services, even with SP1
Sub-par validation support, with INofityDataErrorInfo missing
The WPF toolkit has been practically abandoned, whilst Silverlight toolkit and theming are very much active.
No Fluid UI
If you can live with the performance, it seems like Silverlight is the more productive and compelling choice, at least until MS makes some effort into leveling the two platforms.
The thing is, Microsoft seemed to have developped WPF at the beginning, but failed to really keep it fresh. On the other hand, they are working on improving Silverlight, releasing new version almost every years.
I still like WPF over typical windows forms and find that not having RIA services isn't much of a problem since you can still access databases the way I am used in normal Windows Form.

Defining reliable SIlverlight 4 architecture

It's my first question on SO. I know that there were many topics on Silverlight and architecture but didn't find answers that satisfies me. I'm ASP.NET MVC developer and are used to work on architectures built with the best practices (loose coupling with DI, etc.)
Now I'm faced to the new Silverlight 4 project and would like to be sure I'm doing the best choices as I'm not experienced. Main features required by the applications are as follows :
use existing SQL Server Database but with possibility to move to the cloud.
using EF4 for the data acess with SQL Server.
exitensibility : adding new modules without changing the main host.
loose coupling.
I was looking at different webcasts (Taulty, etc.), blogs about Silverlight and came up with the following architecture.
EF 4 for data access (as specified with the requirements)
WCF RIA Services for mid-tiers controling access to data for queries and enabling end-to-end support for data validation, authentication and roles.
MEF Support for enabling modules.
Unity 2.0 for DI.
The problem is that I don't know how to define a reliable architecture where all these elements play well together. Should I use a framework instead like Prism or Caliburn? But for now I'm not sure what scenarios they support.
What's the best usages for Unity in Silverlight ? I used to use IoC in ASP.NET MVC for loos coupling and other things like interception for audit logging. It seems that for Silverlight Unity doesn't support Interception. I would like to use it to enable loose coupling and to enable to move to the cloud if needed.
Thanks in advance for your help.
Best practice in Silverlight is actually (IMO) a bit a myth. By definition "Best Practice" refers to practices that generate the best results overall (quick to market, fast iteration of versions, low bug count, etc). However Silverlight 4 isn't even in production yet so its not actually possible to pin point what ultimately has turned out to be "Best Practice.
On top of that Silverlight itself and the technologies that surround it have been very fluid and and are very new. With that in mind here is my 2 pence.
EF and WCF RIA Services are most definitely going to figure in your architecture if you are build a LOB app. (Although NHibernate instead of EF may be worth a look, I tend to bias to MS components unless there is something else that knocks it out of the park).
MEF is most definitely worth further investigation if you are into DI. Its this area which is most in flux right now. I wouldn't be surprised to see Unity and Prism evolve to make greater use of MEF to deliver their various patterns. MEF is particularly good the loose coupling of which you speak.

Creating a Business Type Application Using Silverlight 3 - Is it Appropriate?

I'm considering using Silverlight for a business type application which will contain probably a dozen or so screens. The screens will contain data entry forms with edit fields, grids, lookups, calendars, etc. Typical business application type screens. I want this to run in the browser but don't want to mess with HTML, JavaScript, CSS etc. Is Silverlight 3 appropriate for this type of application? Can someone build professional level business type apps with Silverlight 3?
#Randy Minder,
Glad to hear that you want to use silverlight 3 for line of business application.
I used to develop line of business applications in ASP.NET combined with javascript/AJAX. I am currently developing my first silverlight 3 line of business application and found silverlight is better in few departments. The following are the Pro/Cons observed by me PERSONALLY.
Pros
Layout/Styling(CSS)
XAML + silverlight 3 styling is very flexible and less cluttered when compared to CSS. I am not a designer and I hate having to deal with CSS. But in the case of silverlight, I really enjoyed creating the mockup,layout & styling. The end result is awesome. This is the first application that I developed has decent & consistent look & feel. I hope you will also find silverlight xaml to be easier to deal with.
Rich Interaction & Language support
I used to use Ajax, javascript for creating rich interaction experiences like populating some data dynamically when user interacts with UI. Writing some complex UI logic in Javascript is daunting. Though there are some nice javascript libraries like Jquery, I think writing UI complex logic in C#/VB.NET/F# is much easier than to write it in javascript. Dealing with rich interactive controls in silverlight is much easier than with javascript/ ajax controls. Writing server communication code with WCF or WCF RIA service is far easier than with ajax calls.
Browser compatibility
Each browser is different from another in one or the other way, like some browser supports something and others dont. Having to deal with browser differences in javascript is also a pain. Silverlight being a plugin doesn't have to deal with browser differences. No problems dealing with layout engine differences too.
Animations/multimedia
Ofcourse with line of business applications we will not use toooo much of animations/multimedia. However we can use small animations like menu popup, sliding controls, fading transitions for when data changes etc. These are very easy to implement in silverlight than with asp.net/javascript
Validation
Validation support in silverlight is awesome you can write more validation logic in less time.
Popup messages
Popup messages are very clumsy to deal in ASP.NET and sometimes I need to store some information in hidden fields to feed text for popup messages. Hidden fields are used as javascript & ASP.NET interaction components which are difficult to maintain and end up with more code.
Good separation of presentation & model
Though you can separate these layers in ASP.NET also, silverlight enforces this by design which is good. In my team there are few developers who dont want to put effort on separation of the layers. Unfortunately they are the seniors in age and decision makers. I always hate to deal with their spaghetti code. Not to say that I am a better developer than them, I always put some effort to separate the concerns and try to learn how to manage my code. ASP.NET webforms doesnt enforce separation of presentation & model by design. Where as silverlight enforces this by design and my life became easier.
Cons
Clipboard
Users are very much used to copy the content available on ASP.NET/HTML page. Most of the silverlight 3 controls doesnt support clipboard out of the box. The only control I know that supports out of the box is textbox.
Database Communication
Database communication in ASP.NET is easier & direct communication is possible. However silverlight being client side technology it doesnt have direct access to database and a necessity of creating an additional tier is mandatory. Though WCF RIA services make the development of this additional tier easier, still WCF RIA services is in beta as of now. Though I am mentioning it as disadvantage, I did not really feel it is as REAL disadvantage because creating a WCF service is not that difficult.
Client side resource usage
Though cost of hardware reduced alot,client side hardware resources are not unlimited when compared to server side. At my work place, though PC provided have decent configuration, most of the users open lot of applications simultaneously which is required to accomplish their day to day tasks. Silverlight uses client side CPU/memory. Some of my users are complaining that the application I developed is using more CPU/memory than the asp.net equivalent. So if your users have slower PCs, consider ASP.NET or design your silverlight application more carefully.
One may say installing silverlight plugin as disadvantage, I did not face the problem because my application is a intranet application and all users installed silverlight with a single email request.
These are MY experiences with silverlight 3. The only major issue I faced was clipboard support in silverlight, I hope MSFT will address this soon.
All in all, silverlight ROCKS!!! Silverlight 3 is ready for enterprise and if you can wait for few more months Silverlight 4 will be released which has even better support for line of business applications. I dont want to develop ASP.NET applications anymore, that doesnt mean that I will quit using ASP.NET, I will use it only when necessary. I fell in love with silverlight and for a good reason. Designing part of the website is the one I used to hate most but with silverlight designing became one of my favorites.
I hope that silverlight 3 will help you in your decision making.
Absolutely. Take a look at this post about the Vancouver Olympics:
http://csharperimage.jeremylikness.com/2010/02/vancouver-olympics-howd-we-do-that.html
That's just one example of a business application in the "real world" being used to drive a massively complex operation. I posted that just to draw attention to the "business" side of Silverlight, but be sure to click the link to the original post to see the other partners and contributions to the project.
I've been building enterprise/business applications with Silverlight for over a year now. So the answer is an emphatic "Yes, you can" and "Yes, it's been done" and "Yes, it's been done on a large scale with large companies, and very successfully."
I agree #Jeremy. Make sure to use RIA Services with Silverlight , You will get a very manageable/maintainable application. Even one more benefit is that you can make the SL app Out of browser too.

What are the topics to ramp-up on when starting Silverlight\Web development?

I've been asked to do some work on an existing Silverlight project, mainly extending it a bit and doing bug fixes as needed. But there are a couple of ASP.Net pages too and a WCF service to deal with too. My background is desktop development with .Net so I think this is a good opportunity to start getting more involved in Web development.
So I'm trying to figure out what background knowledge I need for a project like this. Clearly I need to get familiar with Silverlight, but I'm not sure what other Web technologies, etc I need to ramp up on for this project. Obviously I would like to know as much as possible but in reality with limited time and resources I really need to focus on what I important in the near term for this project. Then expand my knowledge as things arise.
The things I'm thinking that are important in the immediate future are:
The basics of Web Development (I'm thinking this might be the most important\fundamental area to build a good foundation)
But what are consided the basics?
What is technology\language independent?
What is important for Silverlight?
The basics of ASP.Net (since there is some ASP.Net code)
What are the basics? ASP.net seems so huge, I have a 1000+ pg book here which seems daunting.
If you focus on Silverlight is knowing ASP.Net important, or is ASP.Net something I will continually run into?
How does ASP.Net MVC fit into the overall development picture and especially as related to Silverlight?
The basics of WCF
As compared what?
Any suggestions\comments on the list above?
What other topics\technologies will I run into if I continue doing Web development?
Note: Beyond this project I would focus on the Microsoft stack.
Generally speaking the amount of knowledge of ASP.Net you need to do Silverlight development is very very low.
Silverlight applications are hosted in a browser, usually via the <object> tag. This can sit on an asp.net page or a html page. The Silverlight template creates that for you, so you can forget its there and just get on with the Silverlight app.
Of course if you are integrating into an ASP.net environment (for example, islands of Silverlight sprinkled through an ASP.net site) then thats another thing. There are ways to get Silverlight talking to the HTML dom via the HTML Bridge but its not necessary. Really depends on what you are developing and integrating with. (new site vs existing)
I avoided ASP.net for as much as i could as the richness compared to desktop (WPF) just wasnt there. Silverlight changed all that. Its a Rich world on the web now!
Best place to start learning Silverlight is www.silverlight.net on the getting started part of the site. great Quickstarts and tutorials there.
Good luck
Only cursory knowledge of traditional web technologies (css, html, js, etc.) are necessary for silverlight development. As a consequence, you also don't need to understand the many cross-browser dependencies as well.
Here is my list of things that you must get a really good understanding of to be proficient at Silverlight development:
Understanding WCF (the Silverlight-supported parts) is essential. It can be a configration nightmare, but once working it is pretty stable/ reliable
You need to understand serialization used by WCF and how to debug the mysterious 404 errors. Get good at Fiddler and/or Firebug.
You must understand multi-threaded applications and how do debug them. Silverlight makes extensive use of threading to not block the UI thread. This creates numerous opportunities for race conditions that create what appear to be "magical" results. That said, it is incredibly powerful and IMHO one of the dominant reasons to use Silverlight.
What you learn about serialization and WCF will ultimately help you cache some data in IsolatedStorage. Learn about IsoStorage, it will reduce our bandwidth requirements and cost and improve your user experience
Learn about Linq - again this is one of the most powerful features of Silverlight. Combined with a smart client-side caching strategy you can offload lots of processing to the client.
Figure out how you going to support printing. SL3 does not at all and you will need a server side component. SL4 beta does, but it is not go live
Understand the Silverlight Roadmap as much as possible and plan out your roadmap to match/ sync with it as best as possible. I first built a SL2 app and I spent a lot of time building things by hand that were ultimately released in SL3. As it is getting more mature, there is less of this.
Download the Silverlight Toolkit and use it. But more importantly examine the source code, the structures, its build process. There is not better real world place to look for inspiration & best practices.
Good luck.

Tips for developing on WinForms thinking on a future Web developing

We are developing/mantaining an enterprise application which for historical reasons and development speedup it was targered for WinForms.
Now we are thinking that sooner or later (more sooner than later) that application will need to be Web based.
Thinking on the "to-Web" movement. Which are the most important things we have to consider? Something like, thing on MVP parading (or others), determine now the kind of platform/framework you are going to use, ...
Any experience on migration from winforms to web? Any suggestion to take care?
Aclaration: In our scenario the application would be nice NOW to be Web based but we are realistics. I agree that not all the applications have to be Web based (this is the main reason we developed with WinForms!). But sometimes the requirements changes and, in our scenario, we want to offer that application as SaaS.
The main thing is to completely separate the user interface from everything else. Once you've done that, you won't be rewriting the application in order to port it - you'll just be creating a web UI on top.
NESBAWA (Not Everything Should Be A Web App).
I worked for a company that went through a similar situation with their monolithic WinForms application. From that experience, there are two things to consider:
1] Decouple all data access logic (DAL) from the existing WinForms UI. You can start this process before any web development begins.
We did this refactoring in a series of 6 weekly sprints. Some parts of the app were easy to change - others were made of completely hellish spaghetti code that interwove DAL, inline SQL and UI code all in the code behind of the WinForm.
Once you have this separation in place, supporting two different UIs is easier.
2] Ignore ASP.Net MVC and target WebForms. WebForms was designed to make writing a web application close to the experience of writing traditional WinForms UI code (event driven, component based).
You need to understand the page lifecycle, and there are a few conceptual gotchas around dynamically generated controls that tend to trip up a lot of newcomers - but otherwise it's the most painless way to get a team of WinForms developers doing web stuff. MVC maybe very popular in web circles right now, and it provides a better separation of concerns (though you can achieve similar results with WebForms with a bit if diligence and strong design leadership) - but it requires a higher degree of knowledge. With MVC you're working closer to the metal of the HTTP request/response cycle. WebForms abstracts away a whole lot of that for you.
Best of luck in your endeavour!
John is right.
However, have you heard of the "Empty Client" approach? This is a fairly new approach to developing .NET WinForms applications that can also run as web applications on plain browsers. That approach would allow you to develop your WInForms application and put it on the web if and when you desire with no additional development or adjustments.
One framework that does it is Visual WebGui

Resources