Archive for June, 2006

DLinq

June 9, 2006

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

http://msdn.microsoft.com/data/ref/linq/

OpenAccess

June 9, 2006

Hmmm – time for a few blog posts I think… well some short ones just on a few random bits and pieces I've played with (in amongst the busy but boring times at work lately 🙂 ). One product I had a bit of a play with about a month ago is Vanatec's OpenAccess. While I don't agree with some of there statements regarding NHibernate I did think it had a few pretty good features (they just need to be finished/extended). If your playing with NHibernate then this maybe worth a look at too just as a comparison.

One thing that is pretty cool is how smoothly it integrates into Visual Studio along with the "in the box" reverse engineering option – no need for bamming out your own generator 😉 – basically from inside Visual Studio you can point it at a database and you get your initial cut of classes to work with… thats pretty cool as you can try something pretty quickly – im not sure how good/robust it is for use in a real world scenario though – Ill leave that up to you 🙂 . Theres also a few other bits like web service support etc (its in there but to me still looks to need some work) which is nice to see but is not really as complete as I would like it to be – no doubt it will continue to be extended 🙂

The model seems pretty easy to work with and it does seem to work but one thing I didnt like was debugging it – sometimes it wasnt that intuative (and there seems to be some j# / java going on under the scenes (its been a while since I fired it up) – but its not that cool to see .java.lang… throwing out errors when your running on .net 🙂 )

 Anyways – not really here nor there on it but it is worth a bit of a play with if your looking around at O/R mappers and have been investigating NHibernate. They have a free trial download so install it, read the help, look at the samples and see what you think 🙂

http://www.vanatec.com/en