I have a concept for a WP7 app but I need to establish a connection to a SQL Server from the app. Problem is I cant the method to do this in the the 4.0 framework. I know how to do this in a desktop app but I dont have the same methods available to me when developing a windows 7 phone app. Anyone know how to do this? If the concept is wrong can you direct me to how it should be done?
Silverlight (either on a phone, or a browser) simply can not make such network connections. You're going to need a server to talk to, likely with WCF
Doesn't look like you can at the moment -
http://social.msdn.microsoft.com/Forums/en/csharpgeneral/thread/7b6b8d0b-509d-4ecc-a28d-8804cc22e475
It would be a better practice to front your database server with some kind of web service as exposing a database directly to the internet is generally considered too much exposure for your database.
Related
I have a SQL Server Database back-end. I want an internal network front-end UI, such that it is only accessible within a company network, not the web. Which platform would be best to use for a front-end UI application with a SQL Server database back-end? ASP.NET, PHP, Silverlight, or something else.
I would like to have graphs showing trends in data, and I would like to have the user to be able to select paramters on certain reports.
I do not have much experience with front-end user interfaces so I am open to just about anything.
If you need more information just let me know.
Thanks
If you want to build a front-end mainly for reports , I would suggest using SQL Server Reporting Services.
If you are really interested in having a better UI experience then i suggest you go with Silverlight .You wont get resizable layout ,grid and feature rich UI without using 3rd party tools in ASP.NET.
If you want your application to be used on any device than ASP.NET is the way to go since silverlight has some compatibility issue as you need to install plugin for it .So it all depends upon the requirement .No idea regarding PHP or any other technology
I am making a Silverlight app and what I considered something straight-forward really isn't.
I am in need to create a application where a local database is stored on the web server where the Silverlight application can connect to and whenever a user goes on the application will allow sql queries to be carried out. Main use is Registration, login and event registration.
I have tried the Community SQLite: http://code.google.com/p/csharp-sqlite/
But had trouble getting it to work with Silverlight, my guess is due to poor documentation. I already have made a project containing a lot of work so I just want to implement my SQLite code into that.
Can anyone help
Thanks.
If you want your Silverlight application to have a LOCAL storage database, check out Sterling.
If you want your Silverlight application to query a centralized, server-side database, then you need to expose your database via WCF. RIA services is probably the easiest implementation.
I'm using hessian protocol for communication betwee server (java) and various client applications. Now I started to develop Windows Phone 7 client. I downloaded hessian C# implementation but it does not compile for windows phone 7/silverlight.
Does anyone managed to make it work on WP7/Silverlight? It's looks like there is many thing to be done/changed to make it work, which I'd like to avoid if it has been done by someone already.
Thanks.
What is it that does not compile? I'm guessing that the implementation is probably using sockets. Please keep in mind that Silverlight (and thus, wp7) limits the kinds of network connections you can open ... preferring asynchronous web requests (via the WebRequest class) or WCF services.
Chances are the code you downloaded is having problems with the compact framework version of the network classes available on the phone/silverlight. See this msdn article for more information about the socket support:
http://msdn.microsoft.com/en-us/library/cc296248%28VS.95%29.aspx
If you want to communicate directly between the phone and a server running the hessian protocol the easiest way will probably be to proxy communication via a wcf service running on an asp.net server.
So answer is you have to rewrite hessian C# implementation as Silverlight 4 doesn't have lot of stuff from .net mobile framework, mainly Proxy class.
At work, I want to create a WCF Windows Service that runs on a network server. Then I want to create a WPF application that can be installed on various machines on the network. This WPF application needs to be able to communicate with the WCF Windows Service on the network server.
Is this feasible? Is there a better way to accomplish what I want to do? Does anyone know of any resources that show examples of this? I found some tutorials how to setup a WCF service within a Windows service, but I am unsure how to communicate with it over a network.
Thanks for any advice!
Yes, a WPF application can host a WCF client just as well as (and in the same way as) any other .NET application. You may run into security limitations if your application is packaged as an XBAP for browser delivery, but otherwise it should all just work.
Similarly, a Windows service can host a WCF service. For an example see "How to Host a WCF Service in a Managed Windows Service" at http://msdn.microsoft.com/en-us/library/ms733069.aspx.
You can then communicate with it over the network by creating a client proxy -- the easiest way to do this is to use the Visual Studio Add Service Reference command.
I don't understand your question. You say you saw examples of WCF servers and clients, but you are unsure how to communicate with it over a network. But all of the examples you saw were about the clients and servers communicating over the network!
What's the difference between what you saw in the samples, and what you want to accomplish yourself?
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).