Ahhhh – DLinq if you haven't read about this or had a play with it then DO IT NOW! But be careful – you may love it as much as me and just wish it was out there now 🙂 I had a play with it way back at the first cut, liked it (but then kind of got busy on other stuff) –  and then havent got back to it until a couple of weeks ago. Finally after looking at the msi for over a month I decided that it was about time to install that puppy and see where it was at…

If your just starting then make sure you look at the help files – probably the "DLinq Overview for CSharp Developers.doc" in the Docs folder of the install. Theres a few quirks with the install but you'll get the drift and be praying for its final arrival too 🙂 I for one couldn't get the templates in – damn – yep I ran the vbs file to install it but still no luck – the only thing I really achieved was breaking the information tab guy in the ide (see msdn for an article on the reg key to edit on how to fix that) but no matter what they wouldnt go in. I ran the various scripts people had posted as fixes but still no love. Finally it was down to editing the project file 😀

If you edit the project file (in something like notepad) – just change the following line from this: <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />

to this: <Import Project="$(ProgramFiles)\LINQ Preview\Misc\Linq.targets" />

 (this was with a console app)

Good times! You should be able to compile it but you may not get any ide support. Its not the "best" but it is a beta and you'll at least be able to write your own little apps for a bit of a play :-)… The other thing to check out is the SqlMetal.exe in the Bin folder of the install – this will reverse engineer the class's for you from a database. It seems to work and is the first step to getting some DLinq love! Some inital cool things I noticed was that it uses nullable types and generic collections – and does seem to work (although my database wasnt that complicated). Something I would like added though is when you do a 1-1 table mapping is a constructor on each class that takes in each of the "non-nullable" arguments for that table… this in my opinion is one of the most helpful things out and is something I have had to put into a number of different generators/generator extensions – it would be something pretty cool to get straight out of the generation box 🙂 (maybe I'll write a template and chuck that up… – man – so much to do 🙂 )

Things I picked up on were: attaching/detaching objects is easy, the model to work against is very intuative, it works (always a good one), it supports both lazy and greedy (?terminology) fetches by specifying the mode in the query – pretty cool! – the rest you will see when you play with it 😉

Some things that I'm not in love with are: the ide support (it will come 🙂 ) and var – I know all about var but the thing I hate is that its not a type when you look at it in your code – with your eyes – you have to go fishing. Its the same kind of thing with moving from ArrayList to List of T – you immediatelly look at a typed list and understand it. var to me feels like the ArrayList of C#3.0… just my thought in terms of looking at code – not around compilation etc but just around looking at it…

Anyway – check out DLinq – its awesome! 😀



3 Responses to “DLinq”

  1. Steven R McCabe Says:

    SqlMetal is okay but check out Full Metal Jacket by Caber Computing.com

    Full Metal Jacket:
    o Analyzes your risk and the cost of failing to capture your domain knowledge.
    o Allows you to record / edit your domain knowledge into SQL Server database.
    o Quickly identify which pieces of domain knowledge have not been captured.
    o Easily backups your database schema.
    o Our backups allow you to get your schema under control (Check-In to VSS)
    o Our backups provide developers with a simple way to create an empty test database.
    o Produces C#(VB.NET coming soon) Data Access layer 100% compatible with SqlMetal.
    o Produces organized source code which contains multiple collapse-able regions.
    o Your domain knowledge is extracted from SQL Server comments.
    o Your comments are inserted into the generated source code as XML comments.
    o Intellisense will now display your domain knowledge inside of Visual Studio.
    o Sharing this information will aid developers who do not play inside SQL Server.
    o Now, your positioned to produce production quality help files.
    o Publish the help files with your domain knowledge to non-technological staff.

    Labor saving application that automates the steps associated with schema changes.

    An application that leverages your existing development tools to reduce the cost of developing SQL Server based applications.


  2. Kasper Says:

    I have written a small project about LINQ and DLinq. This might an interesting read for some of you guys.


  3. Paolo Brizzolari Says:


    I just wanted to let you know that the IDE support will be improvd by the final release.

    A few things to note – the var construct is required to support the anonymous types that you can project.

    Check out Lambda expressions – alot like delegates but the syntax is orgasmic.

    Finally – I have been using DLINQ in some prototypes I’m building and what really makes me happy is the fact that you can write the same syntax to query different kinds of data (xml, datasets, sql, IEnumerable etc). This is going to make training developers that much easier for me and should improve the legibility of their applications.

    Good article though

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: