Frans Bouma's blog
The blog of Frans Bouma, creator and lead developer of LLBLGen Pro and ORM Profiler.
-
LLBLGen Pro v2.6 has been released!
After almost 11 months of design, development, beta testing and adding final polish, it's here: LLBLGen Pro v2.6!
This version, which is a free upgrade for all our v2.x customers, has a couple of major new features, the biggest of course being the full implementation of Linq support in our O/R mapper framework. The work on our Linq provider, which we've dubbed 'Linq to LLBLGen Pro', lasted almost 9 months and was discussed on this blog in a series of articles, which I'll linq (
) to below.
In the beginning of writing the Linq provider, I was pretty optimistic that it would be easy and quick, but after a while I got very pessimistic and wanted to skip it entirely as it would simply cost too much effort, and therefore time and money. The main reason was the lack of serious documentation and background on various essential details like which expression trees were formed from which linq queries, and how to understand them in full so a meaningful query could be produced from them to run on the database. Anyone who has written some form of Linq provider or is currently busy doing so will run into this problem. Doing trial-error development/research for a couple of months in a row isn't a picknick, but it's also part of being a Software Engineer so it always left me with a mixed bag of what to think of it: it's exciting and interesting, but also frustrating.
A good example of the lack of serious documentation on expression trees is the way the VB.NET compiler compiles a group-by query into an expression tree vs. how the C# compiler does that: the C# compiler always adds a separate .Select() method call, the VB.NET compiler doesn't. In theory, the VB.NET compiler is right: the group-by clause has to be in the same query scope as the projection, but as C# has to be supported as well, you have to build some form of 'look-ahead' inside the tree to see when / if / how the projection is present after the group-by expression is seen. This isn't documented anywhere. Another one is the way how anonymous types are detected. There's no boolean on the Type object which tells you 'This is an anonymous type'. So you check the name. The C# compiler generates names which start with <>, the VB.NET compiler generates names which start with $VB$. And probably yet another language which runs on the CLR and which adds Linq support might choose another prefix. Nowhere is this documented but it is sometimes required to know that the type you're dealing with is an anonymous type. -
VB.NET: Beware of the 'Aggregate' keyword (updated)
UPDATE I tested this initially with EmployeeID and noticed the strange behavior. Writing this blogpost I thought the max of the employeeID was a little artificial, so I changed that in OrderDate. But... what happened (see my reply to this blogpost below in the comments) ? When o.OrderDate is used, the VB.NET compiler produces a proper expression tree! But when EmployeeID is used, it doesn't. Both are nullable types. When using CustomerID it also works properly. It's beyond me why it fails to produce a proper expression tree when EmployeeID is used. Nevertheless, the advice I gave below is still valid: do yourself a favor and call the aggregate extension methods of All, Any, Max, Min, Sum etc. when you want to obtain these values from a set in a scalar query.
-
See you at DevDays 2008!
Tomorrow, May 22nd, and Friday, I'm present at the Microsoft DevDays 2008 in Amsterdam. I'm told we get special t-shirts, so it shouldn't be hard to find me
. I'll be at the Microsoft Community Booth or in some sessions. If you want to say hi, please stop by! See you tomorrow!
-
Why use the Entity Framework? Yeah, why exactly?
Danny Simmons wrote a marketing piece about the project he's been working on for so long: "Why use the Entity Framework?". I don't expect Danny to be unbiased towards his own work, so at first I just ignored it: Microsoft produces these kind of 'use our stuff, it's better than sliced bread'-articles a dozen times a day. However, this particular article seems to be a discussion subject and is supported by non-Microsoft people on other blogs, so it's time to stop ignoring it and start to refute the contents of the article, despite it being marketing. After all, it doesn't look like it's marketing.
-
Linq to Sql support added to LLBLGen Pro
Imagine, you're sitting at your desk and you're using the Linq to Sql designer in VS.NET 2008 and you have, say, 50 entities in your model. You're happy about how things are progressing. It took a while to get the model set up, considering the wicked table and field names they cooked up in the DBA dungeon, but after some swearing and too much caffeine, it's done. The model which is smiling back at you is what you had in mind.
Rain slams against the window and the DBA you have heard about but never had the chance to meet in person, walks into your office and with her whiskey-shaped voice she almost whispers into your left ear:
"Son, I've updated a few tables in your catalog schema, hope you don't mind. See ya!"
Before you can ask her why she found it necessary to do such a terrible thing to you, she's dissapeared, back to her basement.
In shock, you stare at your shiny Linq to Sql designer, in it your 50 entities in full glory. Which tables were changed? What has she changed? WHAT!? You start telling yourself not to panic, when the idea of checking manually each and every of those 50 tables for changes, manually rebuilding the Linq to Sql model, re-doing your inheritance hierarchies, renaming the fields is causing a slight increase in sweat production. Why did you decide to wear this grey shirt to work, today! -
Dynamic Data and 3rd party o/r mappers is a fact
In the latest public preview of Microsoft's Dynamic Data, they've added something else besides what's publicly advertised: support for 3rd party O/R mappers!
A couple of weeks ago, Bryan Reynolds mailed me about LLBLGen Pro support in MS Dynamic Data. I initially hadn't payed much attention to Microsoft's upcoming Dynamic Data initiative, as it's more geared towards web developers and was Linq to Sql / Entity Framework only as it seemed. He gave me a demo of Dynamic Data using Shared View (which works pretty well) and it got my attention. It's a clean, easy to use technology to get smaller websites which have to deal with data-entry, up and and running in no time. -
this.AddAward(MVPAwardFactory.Create());
Microsoft has awarded me again this year with an MVP award for C#! I won't be at the MVP summit this year though (held in 2 weeks).
-
Anti-agile hatemail
Today I received through the contact form on this blog a hate-mail from a guy who called himself 'Ryan'. Ryan used a fake, non-existing email address so the only way to respond to him is via my blog, hence this post. Let's look at the email first:
From: ryan@notanoob.org
Subject: (Frans Bouma's blog) : anti-agile
Your post on Jeffrey Palmero's blog is laughable. He is a smart and successful person and is involved in practices that you do not understand. Your post makes you look like a moron. You obviously have a lot to learn about agile development.
The ONLY thing that works on large .net projects is the platform independent knowledge that the java / C++ / small talk community has learned over the past 20 years. I know because I work on a 3 million LOC, 200+assembly .net product every day. MS built the best development platform, but what MS teaches is crap. In the end, the culture of the development shop is what makes or breaks it. Agile practices focus on that culture. Tools and processes are secondary.
One day when you work on a real app that is more than 100K lines of code maybe you'll understand. You should not venture outside of the realm of your fan base, which is newbie developers that have a background in ASP.
I would love to see your product choke on several of our 100+GB databases.
Thanks.
-
Beta of Linq to LLBLGen Pro released!
Today we released the beta of Linq to LLBLGen Pro to our customers so they can dig in and check if we provided the right code, if everything works allright etc.!
If you're an LLBLGen Pro v2.x customer and you want to check out our Linq implementation, please check the customer area to download the beta package.
-
Developing Linq to LLBLGen Pro, part 14
(This is part of an on-going series of articles, started here)
We're getting closer to the goal: a full-featured Linq provider for LLBLGen Pro. Hopefully next week the Linq CTP for LLBLGen Pro is ready for release to customers, fingers crossed! Last time I talked about the function mapping support for database functions and in-memory function/method/property access extravangansa, today I'll discuss one of the cornerstones of using an O/R mapper in the first place: fetching trees of objects using hierarchical fetches.