Yesterday when porting LinqtoCRM to VS 2008 Beta 2, I had to get an array of the types of the properties of some generic type. This array would be passed to Type.GetConstructor(). I had an array of PropertyInfos which contain the type of the property, and I could have new’ed up an array and looped the types into that. Instead I did this:
A new beta of Visual Studio was released yesterday, you can read up on the general stuff at ScottGu’s Blog.
The release broke the various projects I’m working on in weird and wonderful ways, here are some of them:
The expression tree grammar has changed, some types have disappeared only for new ones to show up.
Anonymous types no longer have a zero-argument constructors (from the reflection API), but have to be initialized with their full complement of properties. The properties are read-only, even through the reflection API.
The old expression-tree visualizer doesn’t work with the new expression trees, get the new samples.
The IQueryable interface has been expanded to include an IQueryProvider-property. Depending on your implementation, you can get around this be returning this and implementing IQueryProvider in your IQueryable (as a side note, it would be great if someone could document the thinking behind the various interfaces floating around in System.Linq, even if it’s still subject to change).
I haven’t really pondered the deeper implications and/or motivations of these changes, merely dealt with them.
UPDATE: Matt Warren has written a coherent description of the IQueryable and associated interfaces, parts 1, 2, 3, 4 and 5.
I’ve uploaded an initial version of LinqtoCRM to CodePlex. It’s a proof-of-concept more than anything else, but it will handle some non-trivial queries (like joins). The goal of the project is to abstract away CRM’s (necessarily) clunky web service interface and unleash the amazing application platform underneath. While I’ve worked with Linq as part of my thesis for the last couple of months, I managed to throw this code together over the weekend. If you have good examples and a bit of compiler-knowledge, creating your own queryprovider is not overly hard.
After several false starts, I think I will now have enough material to post regularly. The posts will probably concern mainly LINQ (the subject of my master thesis), Dynamics CRM(which I work with daily) and C#/.Net/Web-tech in general — for the near future at least.
While Hemingway’s prose will consistently make the hairs on the back of my neck stand on end, that is — in fact — not the reason I chose the hemingway reloaded wp-theme. I just happen to think it’s aesthetically pleasing. I’ve made a few minor mods, including removing the credits in the lover left corner. Instead I’ll credit the creators here: Thank you startup365 and Kyle Neath for a beautiful theme. If I find the time, I may mod it some more. I’m thinking …CGA!
The blog is hosted at ITU, it’s free, has an agreeable LAMP-stack and plenty of bandwidth (not that I’ll need it).
If you want to know more about me, check the about page.
UPDATE, 04-08-2007: Google Code Prettify is now syntax highlighting code in posts.