I am currently writing a Metro application and I want to integrate managed SQL handling within my app by connecting it to my web SQL DB.
What are my options for .NET 4.5?
Also, if you downvote, please explain why, I know there is some MySQL connector for .NET 4, but it is obviously incompatible with 4.5
I strongly advise against client programs connecting directly to a database server over the Internet, for the following reasons:
- Client libraries are designed and built around the assumption that the database is under a few miliseconds away, especially very chatty protocols (MSSQL is amongst these). Short operations might take considerably longer as a result.
- It's a security liability, not only are you exposing your database server to the Internet, but you're also embedding connection details (such as passwords) in your application.
- It doesn't lend itself to scalability. What if you introduce multiple load-balanced or failover database servers, you'd have to rewrite your client.
- It also assumes that there won't be any connectivity problems. Many networks (especially mobile networks) restrict activity outside of port 80/443 to prevent abuse of their network (such as zombie users launching attacks).
The ideal solution in these cases is to develop a web-service frontend for your database; your application would then interface with the web-service instead of your database. This has other advantages.
Of course, clients (especially mobile clients) should use a data cache so the application will continue to work when offline.
Back on-topic: assuming you still want to go with a direct connection, then I don't see why the MySQL client library won't work on 4.5. You can modify an assembly's manifest/configuration so that it will run on future versions of the .NET CLR (you'll only run into problems if said library uses since-removed types and members or relies on changed behavior. The .NET framework has a good reputation for backwards and forwards compatibility).
Metro applications distributed via the App Store are sandboxed so you'll run into problems if you use MySQL. If you want a simple database I recommend SQLite. If you want to be assured of portability avoid any "mixed-mode" implementations - there exists a "pure" .NET implementation available here: http://code.google.com/p/csharp-sqlite/
There are plenty of GUI tools you can use to administer and design SQLite databases too.