SQL Server install with Silverlight 4.0 OOB - silverlight

I have a Silverlight app which needs to talk to a local SQL database, we plan on deploying this Silverlight app to Azure. Users will navigate to the app and install the app using the Out-of browser feature.
How should we plan on installing the SQL database on the local user’s machine in such cases? This app runs in offline mode for the most part except when synchronizing with the remote server, so a local SQL database is required.

You won't be able to use anything like SQL Express or similar on the machine from an OOB application (unless you are running elevated) as you will still be constrained by the sandbox and the libraries available to you in Silverlight are limited.
Instead consider using a compact database that can be stored in Isolated Storage, something like Siaqodb, vistadb, or silverdb.
One other thing to look at is the forthcoming Sync framework for Silverlight, which is designed to offer offline support for data from SQL or SQL Azure. See this webcast: Building Offline Web Apps using Microsoft Sync Framework.
If you are running elevated, then you can use COM to interact with the local system, so you would be able to access a full-fledged database that way. However, making sure the prerequisites were in place and dealing with managing the database would be a lot of work. I wouldn't recommend it for your scenario.

Related

How do I access SQL Server from Windows 8 apps?

I realize that a local SQL Server instance is not accessible to my Windows 8 app. Instead, I have a SQL Server in Azure. In SQL Server Management Studio, I just change the querystring and interact with the Azure database like any other. How can I reference that database in my Windows 8 app?
This is what the Azure Mobile Services SDK is for. Scott Guthrie did a writeup on it a while back.
Undoubtedly you're aware that both ado.net and Entity Framework are missing from WinRT... Notice the glaring absence of support for System.Data.
You can't access directly on sql databases.. Because Windows 8 Apps different from windows forms.
But you can be used web services or azure, amazon services, storage files etc.
sounds like you want to develop a web service talking to your database, deploy it to IIS on your Azure instance and then consume it from your Windows 8 application (by adding a web reference to your web service in Visual Studio).
You can also place an OData head on the database, then use various OData client-side libraries to talk to it via REST. See http://www.odata.org/libraries for both client and server libraries. SQL Server on Azure is definitely supported, as is .NET, JavaScript, and other platforms on the client side.

Database Schema Migration on Azure with Git Deployment

I am looking for a means to use Git deployment on Windows Azure together with either their MySQL or other database solutions.
I need a means of migrating database schema changes as part of deployment - does Azure provide support for this without using Visual Studio or .NET.
You basically want to use Azure as a Continuous Integration (CI) platform and my view is that Azure by itself just isn't there yet.
A basic git based CI scenario would involve the following steps.
Your src code and any database schema/data updates are pushed to a central git repository like GitHub. [Feature available]
GitHub would then push the updates to Azure. [Not supported in Azure until they support GitHub hooks]
Azure compiles and deploys the code. [Supported]
Azure updates the database from sql files pulled from the repo (remember, this needs to be automated). [Not supported]
Azure reports any error in running the database or web application. [Supported]
Azure runs user provided integration tests to check more thoroughly specific functionality and reports the status of those tests to the user [Not supported].
Azure allows you to roll back to a previous deployment snapshot [Partly supported. Snapshots are not based on git commits for instance].
I might be wrong on some of those points or new features might be added since I've written this. Corrections are very welcomed and I'll try to update the list accordingly.
I am not sure how much experiences you have with Windows Azure Websites, however when you are creating a Windows Azure Websites, you have ability to use SQL Azure Database or MySQL cloud database directly integrated with your Windows Azure Websites.
So if you will use SQL Azure Database then there are several ways you can migrate your DB following the link here:
Migrating Databases to Windows Azure SQL Database (formerly SQL Azure)
To manage MySQL you can use Local Web Server to do it. The way I have done is to use PHP, the MySQL Command-Line Tool (part of MySQL), and a web server set up on my local machine, and that I have enabled the PDO extension for MySQL. This way I can manager my MySQL directly from my own local machine and the details are explain at the bottom of this article:
Create a PHP-MySQL Windows Azure web site and deploy using Git.
Also the SQL part you can write in Workbench if you use MySQL and Oracle SQL Developer if you use Oracle SQL.
Finally Git Deployment allows you to deploy your any kind of application directly to Windows Azure without using VSx.

Standalone Database Option that works well with EF and is easily deployable?

I recently started a Winforms VB.NET application that uses a mysql database to store information. Problem is this is a standalone system no network access to the database is needed. And installing mysql server, along with the connector has become a great burden. Is there a viable alternative database engine that will be non-transactional, and EF still works with. This database just needs to keep up with client details, payment History, and related items..
SQL Server Compact might work for you, depending on it's limitations. If not, SQL Server Express will work fine

Is SQL Azure suitable for Desktop client applications

I have a client that runs a small business. They need a custom database solution and I'm looking into various options. My experience is limited to .NET using local SQL Servers (no ASP.NET), however, this client is non-technical and would benefit from being able to outsource the DBA tasks. I'm a complete Azure noob, I just scanned the tutorials and they all appear targeted at developing MVC ASP solutions. The client doesn't need a browser based solution. A fat desktop client used from different geographical offices would be the least expensive option I can deliver. I'm just trying to save some time going through all the tutorials and docs only to find out that this isn't what SQL Azure is intended to do. In effect my questions boil down to:
Can I develop a C#/.NET WPF desktop application using Entity Framework 4 and have it hit SQL Azure instead of a local SQL Server?
Are there any known gotchas with EF4 and SQL Azure?
Are there other hidden development costs/complications in using SQL-Azure instead of a local SQL Server.
Is the basic tool support the same? One specific example I can think of; do I get a SQL profiler tool for troubleshooting?
The final question is security related and I'm not sophisticated enough to ask a good question, but is hitting a SQL Azure db this way considered a security no no?
Yes, you can, but a more suitable approach would be to use WCF Data Services or another form of web services (asmx or WCF) as a services layer for your application. I like this approach for line of business applications. I hate web apps for line of business and by using a services connected WPF desktop application, you get the benefits of running in the cloud and having a cloud offering without the necessity to be HTML based.
SQL Azure has full support for EF these days. In the past there were some issues, but I have not encountered any these days.
In terms of development costs and complications - the Azure desktop hosted environment is a bit of a PITA from a development perspective, but I haven't had major problems. You lose the ability to share a local DEV SQL Server unless you use a hosted instance....of course there's a development cost in that because you have to pay for usage.
Good point! SQL Azure does not provide SQL Profiler support at present. I personally use the built in EF tracing support for this functionality.
Exposing a SQL Azure DB directly isn't a good idea from a security perspective. That's why I suggest hitting a WCF Data Services (or other web services) endpoint in point 1.
You can develop a desktop or on-premise application that uses SQL Azure for your database.
You need to take the standard Azure precautions - assume that connection failures will occur and ensure that your application has retry logic to restore operation. Also note that SQL Azure will terminate any operations that take longer than a minute, to preserve the service for other users. If you have lots of data and some nasty queries, that might be relevant.
EF works fine with SQL Azure. There are some limitations to SQL Azure, itself, which you can read about from the documentation on Microsoft's web site. If you design you database for Azure, it'll work fine on SQL Server or SQL Express (but not necessarily the other way around).
In addition to the monthly charge for the database, you will pay for data that leaves the data centre. Design your application carefully to minimise the amount of data that is retrieved from the database. You no longer have to pay for data going into the data centre, which helps.
You can still use SQL Management Studio and Data Connections within Visual Studio. No SQL Profiler, though. There are a few irritating things you can't do with Management Studio, but nothing insurmountable.
You will have to open up firewall rules for access to the database, but hopefully, they'll be limited. Authentication is by SQL Server credentials, not integrated authentication.
I wouldn't tend to do it this way, but it works.

How to install a custom desktop application database to SQL Express?

I have a WPF desktop application that uses a custom database for storage.
I need to prepare a setup project (from Visual studio 2008) (full setup, not ClickOnce).
I can add the to the list of prerequisites to the application and it does install during the setup of the application.
My question is: How can I run a script during the setup to create the database that the application needs? OR how can I restore the database to the client machine during the setup?
Another related question, what would happen if already exists on the client machine? How to detect the instance name and connection data? And then how to be able -if needed- to change the Connection string used by Entity framework to connect to that database?
Thanks,
Ed
SQL Server Express Edition is generally a really poor choice for a local database. It's a server-class engine that likes to use a lot of resources and runs as a service (so it's using up those resources even when your app isn't running). In other words, it belongs on a server.
The only place I've seen SQL Server Express used on a desktop that almost makes sense is as part of the Microsoft Small Business Accounting app, and in this case you generally install that program on a machine who's primary purpose is doing the accounting for your business.
What you should do is use a desktop or in-process class engine like SQL Server Compact Edition, Sqlite, or even Access. This will also greatly simplify your deployment.
If you insist on pushing through with this, know that the installer will create a new instance of sql server on the system. SQL Server will be fine with this. However, you'll need to account for that in the connection string of your app, and that can be a little more complicated. Additionally, to set up the database you have a couple options:
Create it from client code on first start of the app
Create it with a custom installer action (hard to get right because msi permissions)
Distribute an pre-build *.mdf file and attach with custom installer action or on first start of the app.

Resources