Share via


Visual Linq query builder for Linq to Sql: VLinq

Hi all,

After almost one year of work and organization, I am very happy to share this project with you:

https://code.msdn.microsoft.com/vlinq - new setup fixed (4/17/2008)

The Visual Linq query builder is a Visual Studio 2008 addin. It's a designer that helps you create Linq to Sql queries in your application. Both C# and VB projects are supported.

clip_image016

As you will read it in this post, this project developed by interns is a prototype for a new kind of designers.

Please give us your feedbacks !!!

Project history

It is an academic project developed during a Microsoft France internship in collaboration with Microsoft Corporation.
I have been the 'local' manager and technical lead of the project. I wanted to create a VS designer using WPF for a long time and I had the idea of a query builder for Linq to Sql. Then came the opportunity to organize a 6 months long internship in collaboration with Ms Corp.

I have recruited two french students that I want to thank again today for their excellent job.

- Simon Ferquel from SupInfo who is now working in a french company (Winwise). You may know him from the time he was student as the author of a funny tool for Vista : myExposé.

- Johanna Piou from ISEN Toulon who is still student this year and who is well known for her brilliant Imagine Cup participation in the Interface Design category.

You can find the French description of the project here: https://msdn.microsoft.com/fr-fr/vcsharp/default.aspx (coming soon).

The project goal

Linq to Sql and Linq more generally speaking, is a new technology mainly based on language evolutions. As any new syntax, you have to take some time to get familiar with it.

The VLinq project as any designer helps you to build graphically Linq to Sql queries but we wanted to keep it visually very close from the code. The goal is not to hide the generated code but to make it visible in the designer. It's a kind of mix between a classical designer and a graphical intellisense.

VLinq also helps you grouping all queries at the same place allowing easy management (edit, add, remove) and previewing and testing.

Last goal: releasing the whole solution, including source code to share with you our experience about using WPF with VS2008 extensibility.

What do we release ?

The whole project has been developed using Visual Studio 2008 (betas then RTM) and Expression Blend. We provide the whole solution (binaries + source code). The solution contains a Setup project for a quick installation (msi file).

You can get all the stuff here: https://code.msdn.microsoft.com/vlinq/ under the 'Releases' tab. (msi, quick reference guide, user documentation, webcast).

---------------------------------------------------------------------------------------------------------------------------------

Quick Reference Guide

Once Visual Linq Query Builder is installed, you can create a new project or open an existing project (C# or VB.Net). From this designer you will be able to create, modify and delete queries. When editing a query, the query designer will appear and let you build your query visually. At each time the designer is saved, the corresponding code (C# or VB.Net) will be generated. Then the queries are ready to be used by your project. The following steps are for the first time users of Visual Linq Query Builder.

- Create a new project

If you installed Visual LINQ Query Builder, you can create a new project or open an existing project (C# or VB) in Visual Studio.

clip_image002

- Add a LINQ to SQL class

Once a project is created, a LINQ to SQL class should be added to the project.

clip_image004

- Add connection to SQL database

If Linq to SQL class is added, a .dbml file is added to the project. You open the .dbml and can set the connection to SQL database by clicking “Server Explorer” and “Add Connection”

clip_image006

To work with LINQ to SQL and Visual LINQ Query Builder in Visual Studio 2008, you will need a database that you can query. If you already had a database, you can set the connection to the database by clicking “Server Explorer”.

Otherwise, you can access the copy of the Northwind database that accompanies the C# samples that ship with Visual Studio 2008. You can also download the latest C# samples from https://msdn2.microsoft.com/en-us/bb330936.aspx. The Northwind.mdf will be found in the directory, CSharpSamples\LinqSamples\Data.

The setup guideline for the SQL database can also be found in Charlie Carvert’s bolg.

You can set the connection to the copy of Northwind.mdf or your database.

clip_image008

Once connection is added, you can navigate to the objects in the database and select a table you want to query.

- Add the designer to the project

Add a new item, “VLinq queries” to the project. When opening the new .vlinq file added to your project, the query bag designer will appear.

clip_image010
- Set the connection to VLINQ

In the Properties of the vlinq, set Connection String to the database you want to query. Select “Visual studio Connection” and the database.

clip_image012

- Create a new query

If you open the .vlinq file added to the project, you can see query bag designer. In the query bag designer, you can create a query using the query bag designer by clicking an icon “Create a new query”.

clip_image014

- Edit the query in the query bag designer

clip_image016

- Query in collapsed mode
clip_image018

- Preview the query result

Once you edit the query and “save” the .vlinq file, the code is generated. If you click “Preview”, you can see the query result in the below.

clip_image020

- View the generated code

Query designer code is generated if you save the query. You can build the project using the code.

clip_image022

Have Fun !

Mitsuru FURUTA - Microsoft France

Comments

  • Anonymous
    April 02, 2008
    Letztes Jahr konnte ich bereits einen frühen Prototypen von VLINQ sehen. VLINQ ist ein Addon für

  • Anonymous
    April 02, 2008
    This looks like a VERY cool project! Thanks for releasing it... I grabbed the MSI, installed it (on Vista), but don't see the solution/source. The C:Program FilesMicrosoft VLinq Query Builder folder only has the bin's, ico, etc Is the MSI only bin's or does it also contain the source? Thanks, Greg

  • Anonymous
    April 02, 2008
    Ref:http://blogs.msdn.com/mitsu/archive/2008/04/02/visual-linq-query-builder-for-linq-to-sql-vlinq....

  • Anonymous
    April 02, 2008
    I tried to sign in on the code-website but that does not seem to work. installed on VS 2008 Pro RTM on Vista Ultimate x86. not working, no designer icon in vs items. something in setup is not working. the files are there ... looks like VS has the stuff. perhaps we need to run devenv with a packages command ??

  • Anonymous
    April 02, 2008
    Very strange. Can you check the file 'VLinq queries.zip' is in Program FilesMicrosoft Visual Studio 9.0Common7IDEItemTemplatesCSharp1033 If so, close all VS instance and try 'devenv /installvstemplates'

  • Anonymous
    April 03, 2008
    Thanks to Denny, please try to run the setup 'as admin' if your under Vista.

  • Anonymous
    April 03, 2008
    Salut Mitsu, super l'article... J'ai 1 souci avec mon VS.NET 2008 prof.; je vois pas "LINQ to SQL" dans Add Item... Tu sais comment fixer ça ? merci -Vince

  • Anonymous
    April 04, 2008
    The comment has been removed

  • Anonymous
    April 07, 2008
    Hi Mitsu! Thanks! Seems to be a great tool! I've tried installing it on 'VS.NET Team Suite 2008 RTM' without success. The installation ends successfully but "VLinq Query" item is not addded to the item list. Following your guides, I checked "Program FilesMicrosoft Visual Studio 9.0Common7IDEItemTemplatesCSharp1033". It didn't contain the 'VLinq queries.zip' file so I added it from the sources by hand and ran 'devenv /installvstemplates'. This time 'VLinq query' was shown in the items list but when I try to invoke the designer of my VLinq query, I get the error 'cannot locate resource 'querybagdesigner.xaml'. My Windows is XP SP2. Any ideas what the problem is?

  • Anonymous
    April 07, 2008
    Hi Mitsu! Thanks! Seems to be a great tool! I've tried installing it on 'VS.NET Team Suite 2008 RTM' without success. The installation ends successfully but "VLinq Query" item is not addded to the item list. Following your guides, I checked "Program FilesMicrosoft Visual Studio 9.0Common7IDEItemTemplatesCSharp1033". It didn't contain the 'VLinq queries.zip' file so I added it from the sources by hand and ran 'devenv /installvstemplates'. This time 'VLinq query' was shown in the items list but when I try to invoke the designer of my VLinq query, I get the error 'cannot locate resource 'querybagdesigner.xaml'. My Windows is XP SP2. Any ideas what the problem is?

  • Anonymous
    April 07, 2008
    Hi, It seems that you are not on a english system. Next release will be localized.

  • Anonymous
    April 07, 2008
    No! I am using the English version of Windows XP. I've just noticed one problem. My Visual Studio is installed on 'D:Program FilesMicrosoft Visual Studio v9.0' but the item templates copied by the installer is put on 'C:Program FilesMicrosoft Visual Studio v9.0'. I've put them in the correct path manually but still the same problem with finding 'querybagdesigner.xaml'.

  • Anonymous
    April 07, 2008
    No! I am using the English version of Windows XP. I've just noticed one problem. My Visual Studio is installed on 'D:Program FilesMicrosoft Visual Studio v9.0' but the item templates copied by the installer is put on 'C:Program FilesMicrosoft Visual Studio v9.0'. I've put them in the correct path manually but still the same problem with finding 'querybagdesigner.xaml'.

  • Anonymous
    April 08, 2008
    The Visual LINQ Query Builder is a Visual Studio 2008 Add-In and designer that helps you create LINQ to SQL Queries in your application.

  • Anonymous
    April 08, 2008
    The Visual LINQ Query Builder is a Visual Studio 2008 Add-In and designer that helps you create LINQ to SQL Queries in your application.

  • Anonymous
    April 09, 2008
    Great!  Big help - I've been teaching Linq and I think this will really help - especially with the joins. Thank you!

  • Anonymous
    April 09, 2008
    Visual LINQ Query Builder add-in looks very cool

  • Anonymous
    April 09, 2008
    My source code reading didn't have any rhyme or reason to it this week, but most of them were large,

  • Anonymous
    April 09, 2008
    Visual Linq query builder for Linq to Sql: VLinqThe Visual Linq query builder is a Visual Studio 2008...

  • Anonymous
    April 10, 2008
    The comment has been removed

  • Anonymous
    April 10, 2008
    The comment has been removed

  • Anonymous
    April 11, 2008
    Hi, we will fix those issues quickly. Please understand this project is not our daily work. Sorry again for these troubles.

  • Anonymous
    April 13, 2008
    Si hace unos meses hablábamos de una útil e imprescindible herramienta para probar nuestras consultas

  • Anonymous
    April 16, 2008
    Looks pretty amazing, I love the visualization of the collapsed query, it's not often a UI designer can create exactly what a developer wants, but this looks like it. I'll try it just because it looks so cool!

  • Anonymous
    April 17, 2008
    Looking forward to test the VLINQ

  • Anonymous
    April 17, 2008
    The installation has been patched. Thanks for your patience and sorry again for the first setup version. You can still continue to post your comments here and tell if you meet some issues.

  • Anonymous
    April 17, 2008
    Französische Studenten haben als Internship in Redmond ein Visual Studio 2008 Add-In zur visuellen Erstellung

  • Anonymous
    April 18, 2008
    If says 'Connection failed' however I have selected a valid connection from the data connnections within Server Explorer. In fact I can open all tables etc. from the data connections windows.

  • Anonymous
    April 18, 2008
    It continously asked for recompilation when it has already been compiled.

  • Anonymous
    April 19, 2008
    The comment has been removed

  • Anonymous
    April 21, 2008
    I'm trying to do a join between 2 entities. One is a Group table and one is a Status table. The primary key on the Status table is StatusId. There is a foreign key on the Group table for StatusId. They are both GUIDs When I try to use the tool to do a join I get this error: "The Property "StatusId" type is not valid in a join declaration". I know I could just reference Status from within the Group table but I'm just trying to see if the join functionality works.

  • Anonymous
    April 23, 2008
    Welcome to the forty-third issue of Community Convergence. The last few weeks have been consumed by the

  • Anonymous
    April 26, 2008
    The comment has been removed

  • Anonymous
    April 29, 2008
    I'm having the same problem that Jay is having.  All of our keys are GUIDs, and this tool is telling me that "The property <guidcolumnhere> is not valid in a join declaraion".  Great looking tool, just not usable if you're using GUIDs.

  • Anonymous
    May 04, 2008
    Un editor visuale per LINQ-to-SQL

  • Anonymous
    May 06, 2008
    Sul Mitsu's blog viene presentato VLINQ, ovvero E' un add-in per Visual Studio 2008 che consente di creare query per LINQ-to-SQL in modo visuale. Allo stesso indirizzo &egrave; disponibile anche un breve tutorial. VLINQ &egrave; ospitato su MSDN Code

  • Anonymous
    May 07, 2008
    h2.entry-title {font-size: 1.1em; clear:left;} ul.hfeed {list-style-type: none;} li.xfolkentry {clear

  • Anonymous
    May 08, 2008
    thank you for the tool. it provides good help with easiness.

  • Anonymous
    May 11, 2008
    Visual LINQ Query Builder is an add-in to Visual Studio 2008 Designer that helps you visually build LINQ to SQL queries. Functionally it provides the same experience as, for instance the Microsoft Access Query Builder, but in the LINQ domain. The entire

  • Anonymous
    May 12, 2008
    Nice effort, however the tool is extremely confusing! I wasn't able to create a single query, because the tool is not intuitive at-all.  The article was my only hope and it leaves-out far too many details during the walk-through.  For example: I have no idea how the author proceeded from a "New (blank) Query" to this screen, showing a datasource: http://blogs.msdn.com/blogfiles/mitsu/WindowsLiveWriter/VisualLinqquerybuilderforLinqtoSqlVLinq_A02A/clip_image016_2.jpg When I tried to add a datasource, all I saw was a blank dialog with no obvious purpose. The flashing and zooming graphics are neat, but the tool is buried so far down in the IDE and it is too hard to find and the tools' UI is far too vague. Nice initial effort, but this thing needs a lot more work before I can recommend it to my team. I hate to be the dissenter here, but someone had to say it. Thanks anyway

  • Anonymous
    May 12, 2008
    Hi nealb, Even if many people found it easy to use, I take your point. The best I can recommand is to look at the webcast (see link on the project page). Just to remind, this is a free tool developed by interns. One of the goals was to test what kind of new UI we could make for a visual studio addin using WPF. It's maybe not intuitive for everyone but I think it's an interesting try. We will fix some issues but we did not plan to 'work' again on this project. It's free, the source code is provided and I think it's already a good thing !

  • Anonymous
    May 20, 2008
    Apologies for the sparseness of my posting the last few weeks - work and life have been busy here lately

  • Anonymous
    May 20, 2008
    Apologies for the sparseness of my posting the last few weeks - work and life have been busy here lately.&#160;

  • Anonymous
    May 20, 2008
    Apologies for the sparseness of my posting the last few weeks - work and life have been busy here lately

  • Anonymous
    May 20, 2008
    null refference exception is thrown at having section when I click the textboxes (< edit >).

  • Anonymous
    May 20, 2008
    null refference exception is thrown at having section when I click the textboxes (< edit >).

  • Anonymous
    May 20, 2008
    "We will fix some issues but we did not plan to 'work' again on this project. It's free, the source code is provided and I think it's already a good thing !" Move it to Codeplex! Others will work on it for sure.

  • Anonymous
    May 21, 2008
    I had problems on my 64bit XP. Install works but templates don't show up. BUT geez people it's free and it works in some situations. Just say It didn't work for me and move on. Don't slam them because it did not work for you. Well I will try it on my computer at home...

  • Anonymous
    May 21, 2008
    Correction! I was trying to get it to work in a Web Site project and the directions clearly indicate that it works with a Web Application Project. It works great! Wonderful work. Thank you so Much!

  • Anonymous
    May 22, 2008
    【原文地址】 May 20th Links: ASP.NET, ASP.NET AJAX, .NET, Visual Studio, Silverlight, WPF 【原文发表日期】 Tuesday

  • Anonymous
    May 23, 2008
    Mijn verontschuldigingen voor de weinige posts de laatste weken. Mijn werk en leven zijn enorm de druk

  • Anonymous
    May 24, 2008
    nice work really relly good and lost of time saving

  • Anonymous
    May 27, 2008
    Bonjour Mitsu Plus haut une autre personne parle d'un "connection failed" quand il essaye de tester la requete. J'ai le meme probleme et ma connection string est bien definie dans les proprietes. Je peux acceder par le server explorer a mes bases avec la meme connection string donc je ne comprend pas pourquoi VLINQ ne pourrai pas. merci de l'aide que vous pourriez apporte

  • Anonymous
    June 02, 2008
    Mes excuses pour le peu de publications au cours des dernières semaines – le travail et la vie en générale

  • Anonymous
    June 07, 2008
    No he podido, probarlo en mi vs2008, me sigue mandando este error "No se puede localizar el recurso querybagdesigner.xaml", alguna sugerencia de como arreglarlo? Tengo Vista Bussines en Español y VS2008 Professional en Español. Espero su ayuda....

  • Anonymous
    June 14, 2008
    Problems I encountered: 1 I could not get it to generate more than one query in the code. Query bag shows 2 but only one is generated.

  1. When I press the Preview button, It displays "No Data. If your query..." (sorry, I couldn't cut and paste)
  2. When I first create a query it adds my namespace to the Type when generating the code as in: from b in context.GetTable<Namespace.Brand>() when I manually remove the namespace. it compiles correctly.
  • Anonymous
    June 16, 2008
    Hi, It would be really useful to work against different DataContext such as the Entitiy Framework and frameworks such as ADO.Net Data Services . Tom

  • Anonymous
    June 28, 2008
    It appears this VLinq query builder installer (vlinq.msi) works only on VS 2008 eds., Standard or above, but not on Express Eds., as I tried on both versions. Am I correct?

  • Anonymous
    June 28, 2008
    It appears this VLinq query builder installer (vlinq.msi) works only on VS 2008 eds., Standard or above, but not on Express Eds., as I tried on both versions. Am I correct?

  • Anonymous
    July 31, 2008
    Very cool extension.  Have you considered adding this to the Visual Studio Gallery?

  • Anonymous
    August 17, 2008
    This tool has worked as advertised for me...very cool and helpful for this novice.  If anyone knows how to tell it to take the first row in a return set, I would greatly appreciate the knowledge transfer.  Specifically, I'm trying to sort by a column in desc order, then take the top row (i.e. the last row added). Thanks.

  • Anonymous
    August 24, 2008
    Even with the "fixed" setup it is not possible to install it because it does not find "VLinq queries.zip" Any hints?

  • Anonymous
    August 25, 2008
    The comment has been removed

  • Anonymous
    September 02, 2008
    The comment has been removed

  • Anonymous
    September 04, 2008
    For the "recompile" messages, make sure you don't have the *.designer.cs file open. This can prevent it from being regenerated. Great tool for a first round version! Thanks!

  • Anonymous
    September 05, 2008
    Van egy ilyen kis LINQ Query szerkesztő: Visual Linq query builder for Linq to Sql: VLinq Ami &quot;poén&quot;

  • Anonymous
    September 06, 2008
    tengo el mismo problema de Julio Cesar Ortega es decir mis windows (xp sp3 y vista) y mi vs2008 sp1 estan en spanish. Ya pude instalarlo, pero cuando intento utilizarlo, me da el error de no encontrar el recurso.

  • Anonymous
    September 23, 2008
    Its work fine when I need data from Data base but how i do same for  insert update,delete if possible please let me know mails.shailesh@gmail.com

  • Anonymous
    September 24, 2008
    insert, update and delete actions are automatically generated by Linq to Sql. You just have to call context.SubmitChanges()

  • Anonymous
    October 19, 2008
    LINQ defines a set of query operators that can be used to query, project and filter data in arrays, enumerable classes, XML, relational database, and third party data sources. While it allows any data source to be queried, it requires that the data be encapsulated as objects. So, if the data source does not natively store data as objects, the data must be mapped to the object domain. Queries written using the query operators are executed either by the LINQ query processing engine or, via an extension mechanism, handed over to LINQ providers which either implement a separate query processing engine or translate to a different format to be executed on a separate data store (such as on a database server as SQL queries). The results of a query are returned as a collection of in-memory objects that can be enumerated. ================================================= Sam <a href="http://www.widecircles.com">Link Building</a>

  • Anonymous
    November 10, 2008
     allways got zhe error1001:can't find the path D:Program FilesMicrosoft Visual Studio 9.0Common7IDEItemTemplatesCSharpData1033VLinq queries.zip can you tell me how can I setup the VLinq buildder? my Email: mars8466@163.com   thanks!

  • Anonymous
    November 11, 2008
    The comment has been removed

  • Anonymous
    November 11, 2008
    I have tried it all - radio buttons, exact connection string entered manuall... does not work.

  • Anonymous
    February 05, 2009
    When I try to use any operator other than the == against an integer or a decimal; it breaks. For example v.Cost > 1000 it tries to run then it says "String must be exactly one character long". It is not even a string, it is an integer or decimal.

  • Anonymous
    February 13, 2009
    but it can't support other language vs2008...

  • Anonymous
    August 02, 2009
    Hello, I give up,... After many try, it's impossible to make it run on vista and VS2008. I have try all the proposed solution by Mitsu above, but... I will take time to create my query wihtout this wonderful tool. Gilles

  • Anonymous
    August 05, 2009
    Hello, This tool looks really good, however I am a little lost. I have read the posts here and many have helped (e.g. needing to run 'devenv /installvstemplates'). However I am unable to figure out how to set the connection string. I would like to know if you can describe in more details how to get to this dialog: http://blogs.msdn.com/blogfiles/mitsu/WindowsLiveWriter/VisualLinqquerybuilderforLinqtoSqlVLinq_A02A/clip_image012_2.jpg The property window I see for the vlinq class does not have a connection string option. I have also noticed that the video shows a different version of vlinq. I was wondering if I have the wrong version. If so, can you provide a URL for the newest version? Thanks, Will

  • Will
  • Anonymous
    September 02, 2009
    I have just stumbled upon this amazing tool and I have to say thank you it is really amazing what you have achieved, it is a real help. One thing I want to do and I do not know if it is supported is to get things make more complicated select citereon. For example I want to get a weighted average eg: sum(a*b)/sum(a) where a and b are some values in the table. I would do this with a lambda expression normally as say: Group.Sum(Function(f) f.a * f.b) / Group.Sum(Function(f) f.b) I cannot seem to do something like that in your tool but wondered if perhaps it was possible and I was just missing something simple? Thanks again for a great piece of work

  • Anonymous
    November 16, 2009
    Good Software that assembly versions of speches

  • Anonymous
    January 26, 2010
    Hi, I have the same "missing querybagdesigner.xaml" problem with German VS2008 and latest VLinq (4/17/2008) version. May be a workaround or new version the next time? Thanks, Ciao: GG ;-)

  • Anonymous
    August 15, 2010
    Hey Is there anything equal for VB.NET 2010!? THX