views:

41

answers:

1

Hi Guys,

Is there any good nice library to query MySQL DB? I have mysql connector .net installed, and it basically gives me ado.net replaced, like MySQLCommand, MySQLAdapter etc

MySqlCommand command = connection.CreateCommand ();
command.CommandText = "select * from samples";

but you have to write a lot of code anyway, is there any lib, that wraps up this, so I write something like

p = MysqlProvider.Connect();
dataSet = p.Execute(query);

or

array = p.Execute(query);
value = p.ExecuteAsValue(query);

etc?

Any ideas?

Thanks, Dmitry

A: 

Sounds like you are looking for an ORM, be sure to read through: http://stackoverflow.com/tags/orm/faq

In particular Which ORM for .NET would you recommend?

Sam Saffron
Not really, I'd like to run a complex query with many joins and get a resulting set. ORM is 1:1 mapping, like LightSpeed ORM
Dmitry
@Dmitry, joins can be done with LINQ / NHibernate and so on. Its an abstraction so quite often the syntax is different, sometimes it is more concise sometimes it is less powerful. LINQ-to-SQL has an override that lets you execute SQL directly and map to POCO objects. It all depends on your business problem.
Sam Saffron
LINQ2SQL doesn't work with MySQL, all others ORM that works with it - has no way to query MySQL directly and receive associated array or dataset in a return. So that's why I'm asking.
Dmitry
ALSO LINQ parsers sometimes produces completely wrong query. Not from performance, but from tree view. SO you get a different result set.
Dmitry