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! 😀