Using Subsonic 3.0 With Silverlight - silverlight

I am writing a silverlight Line of business application and wanted to use the Subsonic DAL. The Silverlight Project will not allow me to Add the Subsonic reference with the followng error "You can not add the Subsonic.Core.Dll as it was not built against the Silverlight Runtime". I assume that I could create a webservice and add the Subsonic to that, but I would like to just add it to the Silverlight Project. Has anyone done this and if so how. If not is there an easy way to expose the DAL through the Webservice.

You don't want to access your database directly from your silverlight application. This will create a big security hole. Remember that the silverlight client runs on the clients machine and the traffic between the client and the server can easily be tampered with.
For easy access, to a server side API, you can try .NET RIA Services.

To clarify the error message: Silverlight is based on .net, but you can't just run any .net assembly in silverlight. This is because a lot of stuff in normal .net is simplified, not allowed or not supported in client-side silverlight, which makes binary compatibility difficult or even pointless.

Related

Can we share Silverlight application with access Db over LAN

I am developing small institute management system as an academic project in my college.
I am going to develop the project in silverlight 4 or 5. In this project I want to provide attendance facility; i.e students will able to log in application from their respective machine which will be connected to LAN. There will be no internet connection available.
Can I develop this application which will not required internet connection once it is installed but can still accessible to different machine which are connected in a network over a LAN
1.How can I achive this?
2. should I use silverlight out of browser app or simple silverlight app
3. Is there any way to achive this using WPF?
After some research I found out the concept called Intranet which should solve my problem of sharing of source code and database.
About what technology should be used:
its better to develop this application in Silverlight as it is nothing but a subset of WPF.
Even better to develop the app in both technology to start with as I can use same XAML for both technology with few or no changes at all.
Connecting to database will be simpler in WPF than in Silverlight, as the later does not connect to the database directly and needs a service to achieve this. This service can be written using WCF or Ria service even in a php.
#Ash,
Silverlight can be desktop oriented, same as WPF. Caveat in some respects is that Silverlight is simplified to utilize Web Services communication, just like Adobe Flash is.
WPF is more oriented to non-Internat (ie Intranet/LAN) connections but pretty much utilizes the same .Net framework as Silverlight.
Although Silverlight is more platform independent than WPF, they operate the same.
You can take a Silverlight application and transition it to WPF with little to no changes (pending on the complexity of your application) to the code-base.
One benefit for WPF over Silverlight is the ability to utilize Click-Once deployment and Version control. Although you can implement a Click-Once styled Silverlight deployment it doesnt work the same as the majority of the Click-Once deployment models out there for the Desktop applications.
I hope this helps you.

Use Sql Server FileStream in Silverlight application

In a silverlight applicaiton i use entity framework as Data Access Layer. I want to use FileStream Capability in Silverlight applicaiton , but entity framework does not support this.how can i implement this with or without entity framework in silverlight application?!!!
I found some excellent pointers on using SQL FILESTREAM and Silverlight + RIA Services in Chris Rouw's blog:
Storing Files in SQL Server using WCF RIA Services and Silverlight - Part 1
Storing Files in SQL Server using WCF RIA Services and Silverlight - Part 2
Part three available as well...
Pretty good answer to the question here.
Basically, you use an HTTP handler in ASP.Net to return the file over HTTP so Silverlight can download it and serve it up to the client. It is pretty hard to give you much more detail than this since your question is pretty vague.

Move Desktop application to .NET web application - Silverlight or Telerik controls

Our client has a Desktop application (VBA and Access) that they are using for the past 10 years and it is buggy and they want to upgrade it. I want to use the latest MS technologies and plan to make this a web application using .NET 4.0, C#, SQL server and MVC running on the Intranet.
Since the application has many visual components (about 10 different tabs on top and each tab has atleast 10 different controls on it), I was wondering what is the best way to implement the UI layer a .NET web application. The 2 candidates are Silverlight and Telerik controls (we have license for this).
Some issues to consider :
Silverlight Plug-in : Since this new application will only be used internally on the intranet, I dont think installing a Silverlight plug-in will be an issue. Also, since its on the intranet, hopefully download speed should not be an issue for SL apps.
Telerik-MVC : It is really rich in functionality, however, I played around with it (.NET version not MVC) using some of the controls and if there is anything out of the recommended way to use a control, its a pain to get it working.
Skill-set : Do I want to learn how to use a tool (Telerik) or would I be better off learing a technology (Silverlight) in terms of future projects.
I would like to hear any feedback/ issues to help me decide which way to go.
If you are replacing a desktop application then going with Silverlight may be the best approach.
With Silverlight you are writing an application that happens to be delivered across the internet (well intranet in this case). This can be as stateful as you need to be. You have good access (no pun intended) to the database via the WCF RIA Services.
There's also the Prism MVVM model you can develop on top of.
However, I'd double check with the client as to what they are expecting.
Telerik also do a set of Silverlight controls.
If the project time permits, go for Silverlight. Also, if needed, it's possible to create a desktop version (WPF) out of the Silverlight project.
Issues with Telerik control set(or any control set), if you need a control that doesn't exist in the current set, you'll have to either buy from Telerik, or create your own. In the latter case, the whole UI aesthetics might break because it's not easy to create a control matches the tool set.

Silverlight and n-Tier Development - -How is it done?

I've asked several questions on Silverlight the last day or two (I have no experience with it), and I've had some high-level questions answered. I have another high-level question. How is N-Tier development done with Silverlight? What I am considering is a browser based UI and then a c# back-end containing all the business logic and database code. How would a Silverlight client application communicate with such a back-end sitting on another server? Would it be done via Web service calls, WCF or something else? What is standard practice?
Thanks!
For the projects I've worked on. Typical practice is Silverlight providing a client and then communicating back to the back-end via WCF services.
The business logic is then spread/duplicated across the client and the backend.
You'll want to be looking at the WCF RIA Services for this. In combination with Entity Framework this will approach the sort of thing you need.
The Entity Framework creates model that you can extend and include some business logic.
The Domain Services then allow you to expose access to the model and any other range of operations you need via WCF.
The tooling that RIA Services adds to the Visual Studio will dynamically create in the Silverlight application the client side of this Domain service. There is even a provision for you create C# source that is shared by both by both Silverlight and the server code.
If its Silverlight 3 RIA is a better choice to work with. AnthonyWJones has pointed it right, There is a provision to have a shared Source between Client and Server usually Entities code should be shared in both Client and Server to get full advantage of RIA validation and other stuff.

How to rearchitect Hibernate DAO layer of ASP.NET app to move it to Silverlight?

Last try to get an answer on this.
I have a simple ASP.NET app which uses Hibernate for data access.
GUI can call methods on Customer object like "CalculateTotalSumOfOrders()".
Lazy loading (even though it's not optimal) will work for me, and when Orders and OrderLines collections are referenced in the domain objects, they will get automatically fetched from the database.
Now let's assume I am rewriting the same very app to Silverlight because it looks better than ASP.NET.
I am NO longer able to do lazy loading or data access, because Silverlight client runs in the browser.
How can I solve this without thinking too much about what kind of service to use to get data into the Silverlight client?
Your best bet for supporting all of those platforms is to use a web service. There are many different flavors that you can choose from, .NET 2.0 Web Services (ASMX), WCF, REST, if you are using Silverlight, you may want to consider using WCF + LINQ to SQL which is demonstrated here. That combination can also be used in ASP.NET (if running on .NET 3.5) and Windows Desktop Apps (again .NET 3.5).
Also an open source project called InterLinq might be interesting to you, basically it allows you to build LINQ to SQL queries on the client side, and then transmit them through WCF to a server that executes the query and returns the result. That can be found here. I have experimented with it in the past and it works quite well.
One option that would support Silverlight and Windows clients would be the new ADO.NET Data Services in .NET 3.5 SP1. These are a set of services that expose your database schema through a WCF interface. You can then retrieve the data from Silverlight or a Windows Client using a WCF client.
As #McWafflestix has said, you won't be able to do lazy loading any more, but in my opinion that's a good thing because retrieving data is now a much more "expensive" operation.
You're trying to take a server-side app that interacts with your database and does lazy loading, and convert it into a client-side app without a lot of work? Sorry, it's just not going to work. What you need is a major rearchitecting of your application.
Sorry...
*
"That's okay because I'm quite early
there. How would you rearchitect it to
support both ASP.NET, silverlight and
windows clients with minimal
overhead?"
*
I know I am answering this question way past the expiry, anyhow here goes. I would suggest you use the MVP design pattern; this would help you build multiple "Views" to work with your Model. In order to ensure that you support Windows clients, you would have to expose your Business Layer using a services layer (read WCF).

Resources