Using LINQ to connect with multiple databases - asp.net

I am developing an ASP.NET application in which I need to provide support for two databases, MySql and MS SQL Server 2005 and 2008 (one database will be used at a time).
How will I configure the ASP.NET app to connect with different databases without reinstalling the app (i.e. using configuration)?
How will I configure LINQ?
Shouldn't I use NHibernate?

Use basic Linq to SQL structures (nothing database specific) and by just changing the connection string should do the trick. Linq expression trees are transformed to SQL by Linq enabled drivers (i.e. they know how to handle the expression tree).

Here is better way of doing it: Multiple database support with Entity Framework.

Related

Difference between Entity Framework and Microsoft SQL Server

I'm fairly new to mvc, asp.net, and .net framework in general.
I understand what models are, controllers and views, but what I don't get it is Entity Framework. I developed websites before using php, and when I needed to store some data I simply do that using MySql databases. I thought this is the case with asp.net, same concept but instead of MySql, Microsoft Sql server is used. Now I started to learn .net framework and I watched a lot of online tutorials and saw them using some classes inherited from DbContext to store data! Can anyone tell me where these classes store the data and why don't we use Microsoft Sql server instead?
Entity Framework is an Object Relational Mapping tool (ORM), a layer that sits between your database and code. The idea is that the ORM is database agnostic and will handle writing the SQL for you, so that you could (in theory) swap between SQL Server, MySQL, or whatever database you want with only configuration changes.
You can skip Entity Framework and use SQL directly with ASP.Net. Your tutorials just happen to use Entity Framework.

does sisoDB use sql server database to store data

I'm looking for a NoSQL database to use with asp.net , and I came to sisoDB . but as I understood it uses Sql server to save data and so it can use sql server features like security and ... .
is it correct ? and what are pros and cons of this approach ?
As of now the storage is using SQL Server 2008, 2012 - Express edition and above as well as SQLCE, but not in a traditional manner: http://sisodb.com/wiki/core-concepts
I'm planning on other providers as well and also to bring full-text search plugins.

Why would I want to pay my webhost for a MS SQL database over a MySQL database?

I'm in the market for an ASP.NET host to start learning on and to host personal projects. I've noticed most of them provided both MySQL and MS SQL databases. However, usually they will only provided a couple MS SQL databases, but a large number (like 10) MySQL Databases.
Can I use a MySQL database as a back end to a ASP.NET website? If so why would I want to pay extra to use MS SQL over MySQL?
Yes you can use MySQL to drive a website using ASP.NET or any other web development technology for that matter. The reason for choosing SQL Server over MySQL would if there were features or performance characteristics you wanted in SQL Server that did not exist in MySQL. For example, common-table expressions do not exist in MySQL. If there are no features in either that are driving your decision, then it comes down to personal preference and cost.
If you're more comfortable with Sql Server then clearly it'd be worth going down that route, for a small scale site it really does come down to personal preference. That said there are things such as the asp.net membership providers that come, by default, with support for Sql Server as opposed to MySql so that could be a deciding factor for you.
Ultimately, it comes down to personal choice. Which do you prefer and are you willing to pay if Sql Server is your preference?

SQLite from C# - Which is easier to LINQ-to-SQL or Entity Framework?

What would people recommend using as a persistence approach for Sqlite from a C# windows forms application - LINQ-to-SQL or Entity Framework?
(I ask this on the basis that I've had some people say stay away from DataTables and move to one of the new approaches)
LINQ-to-SQL is only available for SQL Server. That may limit your choices somewhat.
Apparently there's a project called DbLinq that tries to port the LINQ-to-SQL interfaces to other databases: http://code.google.com/p/dblinq2007/ . Haven't tried it myself.

Using mySql data in ASP.NET application

I am a newcomer to ASP, and would like to experiment with it by writing a website for a club at my school using .net 2008 and the mySql database available from the school's apache server. What is the best way to set this up, since I see a lot of options to connect the web app to SQL Server or Oracle databases, but I'm nervous that it won't work correctly with mySql.
Also, will I still be able to use LINQ queries?
Get a hold of the MySQL Connector for ASP.NET and start coding as usual for MySQL. the connector gives you all the advantages of data adapters, data readers, etc. in the typical ADO.NET structure you are used to for SQL or Oracle. That way if you do swap things out on the back end in the future, you won't have to worry about swapping out all your connect/query code.
Check out this url: http://dev.mysql.com/tech-resources/articles/dotnet/index.html

Resources