Using silverlight without services architecture
It is possible to create a silverlight businness application without using a se开发者_开发技巧rvices facade like WCF or RIA?
(I mean, directly access a data layer from a viewmodel and consume data from it without the services bureaucracy?)
Silverlight applications cannot read / write from the local machine (except for an isolated storage folder which is unique per application). So unless the SL application doesn't need any data from an external source or from a database, you'll need somehow to fetch the data from a separate machine. You don't really need a service (such as WCF), you can do the data transfer manually using primitives such as WebClient
or HttpWebRequest
, but in this case you'll end up having to deal with bytes on the wire instead of abstractions such as operations, proxies and "normal" CLR types. In most of the cases, using a service helps the application, but if you don't want to use one, nothing prevents you from creating your own data transfer layer yourself.
In a single-user scenario, you could use a database that saves its data in the user's isolated storage like Sterling:
http://sterling.codeplex.com/
Other than that, if you're running out of browser, you can use COM automation to talk to databases directly:
http://justinangel.net/CuttingEdgeSilverlight4ComFeatures
Yes is the short answer, but the result will be more effort for little benefit. WCF and RIA are actually very easy to work with, but you will need suitable IIS hosting.
The power of Silverlight business applications is in the ability to consume disparate services. The value of a business application is in the data, so limiting your data is limiting the scope of your application.
精彩评论