linq to mySQL How can I trick VB Express to use it? - linq-to-sql

I'm currently using VB.NET Express to connect to mySQL over the net. No problem as long as I use plain vanilla SQL connections and statements.
But when it comes to LINQ 2 mySql, I'm struck by VB Express's limitation.
Any clue you gurus?

You'll need to switch out to using something like DBLinq, Entity Framework, or nHibernate instead of Linq-to-SQL. Linq-to-SQL only supports SQL Server and SQL Server CE. This isn't a
limitation of Visual Studio Express at all. Actually, the only limitations I know of with the express editions are that they don't support any Visual Studio plug-ins - but as far as CLR features, you aren't limited at all using Express. And, Entity Framework is built-in and available for you to use out of the box. And stackoverflow has info on the MySQL connector.

After a couple of days searching, Iv' finally reached the Saint Graal!
Since you guys at StackOverflow are so great a bunch of blokes, I've written a little how to sample for you. Here it is:
1 - The ONLY sensible, free and working product I've founr is Devart LinqConnect Express edition.
Its a free product from www.devart.com, capable of:
(Please note I have no particular links nor interest with them.)
Generating datacontext from its own embarked Devart EntityDeveloper free edition
(With some limits in number of tables per context, 10 if I'm right).
Complete the LINQ dlls into Visual Basic Express edition, without having to create a datasource from the datasource explorer.
Ok, once you've installed the package, here's the how to:
Launch the Entity designer from Program Files\Devart LinqConnect and create the model from the database.
Save the model and launch your VB Winform project.
Add the following .NET references:
Devart.Data.Linq
Devart.Data.MySql.Linq '-- Or any other DB you need
System.Data.Linq
Now add the new datacontext.designer.vb file you've created in Entity Developer
to the project:
Right-click the project in Solution Explorer and select
Add existing item
Locate the datacontext file and that's almost it!
Create a button and a datagridview named dgv1 onto your form.
5 more lines of code and you're set!
Button code:
Dim ctx As New myDataContext.myDataContext
Using ctx
Dim tbl = From xxx In ctx.myTable
Select xxx
dgv1.DataSource = xxx.ToList
End Using
The rest is pure cosmetic LOL...
It is worth to mention that although their product is great, the support is great as well!
They answered my questions in less than 12 hours.

Related

MySQL Data Source Entity in Visual Studio 2012

I have also encountered the problem to create a data source in VS2012 with MySQL connector, while many thanks for the connector updates from Oracle.
Than I installed the MySQL connector version 6.6.5, it looks work well while there is no directory in the "Data Source" sub-window but the Model has been created after I created the data source.
When I configuring the insert process to the data using Linq, VS2012 tells there is no such method "AddTo".
Therefore, according the things happened during my programming:
Is it common that the data source will not be shown in that sub window after I have already add the data entities?
Why there is no such method "AddTo" (Actually no any methods at all in the definition) when I using Linq with VS2012?
Many thanks in advance,
Harry

To use existing database on sql server2008 in visual studio 2010 mvc3

i have an existing database on local sql server 2008.
what should i do to access the database and to display the contents of that database.
i am using visual studio 2010 and i have to make a mvc3 web application for which i have to access the database.
should i have to make model classes(entity classes) or rather can these be generated from my database. please help me with this problem.
This is a very open question and any answer will depend a lot on personal preference. I would suggest that if you are using MVC3 and VS2010 you look at Entity Framaework, Microsofts ORM (Object relational mapper).
EF MVC Tutorial
You can produce a Model from the Database or Write a Domain model that mirrors the DB using Code First its up to you the tutorial linked explains how.
Alternatives would include Nhibernate, Subsonic and a bunch of other ORMs or just doing it all your self with ado connections and commands.

Using SQL Server 2008 R2 with Visual Studio Express

I want to create either "LINQ to SQL" classes or use "Entity Framework" from Visual Studio Express 2010. When I attempt to add a data source my only options are:
"Microsoft Access Database File"
"Microsoft SQL Server Compact 3.5"
"Microsoft SQL Server Database File"
Do I need VS2010 Pro to use LINQ to SQL or EF? I thought I could do all of this from Express. I even went so far as to install, "Microsoft SQL Server 2008 Native Client" and it still doesn't show SQL Server 2008 as a data source.
Thanks!
p.s. I feel like a complete idiot that I cannot get this to work
LINQ to SQL (L2S) and LINQ to Entities (L2E) (aka Entity Framework) are part of the .NET Framework, and so are part of .NET regardless of what version of VS you use.
Both first appeared in 3.5 and are updated in 4.0, although LINQ to SQL won't be progressed any further in terms of functionality. Hence there isn't a dependency on the IDE. What might be missing is the LINQ to SQL or LINQ to Entity designers, but I don't think from memory they are.
If you select Add New Item and look in the Data group you should find "LINQ to SQL classes" and "ADO.NET Entity Data Model" - if not perhaps the designers are not part of Express.
[edit]
Seems this has been asked before:
Connecting to SQL Server with Visual Studio Express Editions
For LINQ, use SQLMetal to generate the spew and then just form connection string and let the code connect - you shoudldn't let VS mess with your data representation anyway. SQLMetal's spew is very clean and you can also edit it, once you learn what's what, to make it lighter - or heavier :-) - there are hooks for more code as well.
Before that check that your SQL instance is running and visible - VS installed SQL Express as default instance it can prevent real SQL's default instance from even being visible - a lot of uninstalls in your future if that happened.

Integrating TFS and MySQL

We are developing an application with Visual Studio 2008 and TFS. Our database is a MySQL DB. As we develop we keep the new queries that need to be applied to the database of our new release as the New Version Update Queries. Right now I'm keeping them in a simple text file (which is a painful task!). I know that TFS integrates with MSSQL and makes this job very easy. I've already asked our consultant from Microsoft if there is any way to integrate TFS and MySQL, and his answer was "NO". So I was wondering if anyone knows any smart way of handling this issue?
I think the question may be a little misleading in that I think you're saying TFS when you mean Visual Studio. My guess is that you are looking for a MySQL provider to hook into VS2008 so you can use the database developer features (DataDude) with it? TFS itself is simply a server that provides source control and work item tracking services and isn't designed to work with anything other than MSSQL.
Visual Studio's data tools can be hooked into other databases using the Database Schema Provider interfaces (it's a 2010 feature). An implementation exists for Oracle, but nothing yet exists for MySQL.
My suggestion would be to store your scripts in TFS as regular source controlled items, and keep doing what you are doing until someone writes a DSP for MySQL.

VS2010 ultimate DataBase Project + SQL Server 2008: Updating Project from Database

this is a quick question:
I have this Database Project in a Web app solution with the real database. I want to update the database using SQL server managment studio, and then update the corresponding VS project.
This can be done?
I know that you can update the scripts in the project, but I'm not the SQL kind of guy, i rather do this changes using Mangment studio...
Thanks in advance
Update: Okay, the point is that I want to make changes (if I have to) on the database, using Sql Server Managment studio, and then update the scripts in the Visual Studio DataBase Project, instead of make my updates on those scripts, because I don't feel confortable writing SQL commands. Now what I do is to recreate everytime the Database Project (delete and then create again), this is what I want to avoid
Also, I have Visual Studio 2010 Professional.
It is very achievable in VS2010 Premium and I am currently doing what you describe with a Database Project and a Schema Comparison item.
Sigd is not correct in saying you can only compare Database/Project Compare, you can also compare Project / Database and Database / Database
You can achieve this using the Schema Compare feature, but this is only available with the Premium or Ultimate editions of Visual Studio, not the Professional edition.
In many cases this is possible using Red Gate SQL Compare Pro, although I should warn you that this is not a fully supported scenario just yet (I'm the product manager for this tool so I'd welcome your feedback if you go this route!).
Red Gate's SQL Source Control better fulfills your suggested way of working, although this won't help you just yet as we don't tie into VS Database Projects. Again, this is something we are considering for an upcoming release. You're welcome to try it and let us know what you think.
http://www.red-gate.com/products/SQL_Source_Control/index.htm
If only the Schema Compare tool did what it's name suggests.
Unfortunately it is a "Database/Project Compare". So my project which includes only a single schema, when compared with the database, generates loads of Create actions for all the other schema objects present in the database.
Nice idea, needs work.