TechEd-Dev07: Day 3/1: Using the .NET Language Integrated Query (LINQ) Framework with Relational Data

November 9, 2006 by Alex Duggleby

 

I’m still sitting in the session but before I forget some of the stuff I decided to start blogging anyway, while still trying to concentrate :)

Linq to Sql (formerly known as DLINQ) is an extremely powerfull ORM (object relational mapper). It goes way beyond the products available at the moment. I’ve had some experience in using ORM (both static generators and dynamic frameworks) but Dlinq just goes that little bit further.

Thanks to the query language itself which is mapped to very good SQL, it doesn’t have the performance problems that some of the ORM frameworks have. Anders Hejlsberg is showing us a number of complex linq queries that are mapped to their equivalent complex T-Sql queries.

I should also note that DLinq uses a mapping between class and DB, so it doesn’t generate it on the fly, but there are three way to create a mapping. Create the class manually and attach attributes, use an xml mapping file or use the SQLMetal command line utility that will generate the csharp files and mappings manually. It will generate objects for tables, views (which are mapped to tables), sprocs and functions. Stored Procedures are converted into methods with full Intelli-Sense support and functions aswell. You can (if you specify it manually) also tell the mapper to use sprocs for insert, delete and updates of objects.

Under the hoods it’s using optimistic concurrency and will throw an Exception with options for resolving the problem.

If DLinq is not sufficient enough, because you need to write some more or less complex custom sql code, you can do so and still utilize the Linq infrastructure (identity mapping…) and it will map back to classes.

It’s probably a bit of a learning effort getting to know Linq and all the language constructs, but once you know it, you can rely on the way the sql is generated and concentrate on what you should be doing, the business logic.

Download and more Info on Linq

Tags:

TechEd-Dev07: Day 2/5: Windows Vista: Tips & Tricks for Targeting Key Native Application Program Interfaces (APIs) from Managed Code

November 9, 2006 by Alex Duggleby

 

Visual Studio 2005 and Windows Forms doesn’t now about anything new that came with Vista, so we had a short trip through 4 of the important changes:

1. User Access Control

If you need administrator privileges you have to run in elevated mode. You can do that by config, which gives you general administrator access, or…

you can start a new process from within your app that does the stuff you need administrator rights for. Yes, you can’t actually elevate a method or a class or any in-process object, you can only elevate a complete process. I personally don’t think that’s a usefull way, having to export all you logic to a console app or similar to launch to do the dirty stuff, but on the other hand how much will there be that you need admin rights for. Time will show… but I do wish you could have elevated a method, and the CLR did the dirty (lifting to it’s own procesS) on it’s own.

BTW: for legacy apps there is a per-user virtualization for filesystem and registy. So if old apps are writing to program files and registry, even though they are running as non-admins and won’t have access to them, they will not break, because they are virtualized in this special per-user store. (There are examples of course like High Score where that won’t help.)

2. CommandLink

A new button type in Vista, that is big and has a description. (Ok the marketing guys may describe it a bit differently, but that’s basically it.) To be able to use them in your managed apps, you need to do some dirty SendMessage’ing. We were shown how to do it, then we were shown were the Samples are (in the Windows SDK) and that there was a class that wrapped all of that.

Same goes for the little shield indicating a UAC command comming up.

3. Common Dialog Controls

They’ve changed in Vista, showing a much richer API. So if you use OpenFileDialog in .net 2.0 they will automatically be mapped to the new ones. NO THEY WON’T! Ok, they could have, not quite sure why they didn’t exchange the dll’s or the calls on the Vista CLR, but basically you’re back to PInvoke. But once again they’ve wrapped it one of the samples.

To sum up the Windows SDK has a number of samples that show you how do to the dirty stuff to get the Vista Style, but you don’t have to undestand it, you can just use it (see the VistaBridge sample). It’s unfortunate that they didn’t integrate it better into the CLR or wrap it officially (because the samples are I assume unsupported). It’s similar to the Gadgets where they just seem to have forgotten about their major development plattform (.net) and return back to the basics (dhtml + js).

Now I’m sitting in Anders Hejlsberg’s DLINQ session…

Tags: TechEd-Developers

TechEd-Dev07: Day 2/4: A Day in Life of a Query – What happens when you type GO?

November 8, 2006 by Alex Duggleby

 

It’s a pity the Whiteboard Sessions aren’t marked with difficulty level like the Breakout Sessions. The talk was so informative, but went so deep that I was swimming in all the tech-talk and it was hard to follow everything. I’m sure it was very valuable for the SQL MVPs in the room, but it definetely was a level 500 or so talk…

You can get a log of technical details on Paul Randal’s blog.

Tags:

TechEd-Dev07: Day 2/3: DEMO: biTunes – Business Intelligence (BI) with Sql 2005

November 8, 2006 by Alex Duggleby

 

This was an interesting (and my first demo) track. Basically take the ITunes library as xml, transform it into normal xml using and publish it into a database with SQL Integration Services. Then create a cube with Analysis Services to let the use do some querying and use Reporting Services to create reports.

I’ve been interested in these SQL Server services for a while, but never had the need to look at them. This session gave a great overview on what you can do with them, the business case wasn’t that far off, ok you wouldn’t use a itunes library, but a big xml chunk as input is not that unusual. It was entertaining and showed that it’s not as hard as it looks (for the basic stuff).

Tags:

TechEd-Dev07: AtE: Sharepoint and Custom Outlook Attributes

November 8, 2006 by Alex Duggleby

 

Outlook is the central point of information for the information worker. I’ll just leave that sentence without any further comments.

So when thinking in terms of context-aware environments (and for other business scenarios) where is the first place you might want to meta tag communication (emails) with context information. Outlook of course. So you attach a number of custom attributes to your emails depending on the context.

The next question is how do you find those emails based on custom attributes. There are two ways we would like to do it.

1. the Sharepoint Search way

We’ve just been at the AtE stand for MOSS and they’ve told us the crawler indexes those custom attributes (in public folders) anyway, and through central administration you can specify managed properties wihch then map these to specific Sharepoint attributes. You can also expose them to advanced search. So that’s an interesting way for all your enterprise email.

But the second question ist, what about personal email, stuff you don’t push to PFs and so on. Well the obvious answer would be Desktop Search. Now we didn’t get any response on the NGs about our question (wether it is possible to index custom properties and search for them with WDS -we are using 3.0) so we though we’d go and ask the guy at the AtE. As it happens he’s a very busy man ;) Lot’s of questions and we gave up, so we’ll have to retry tommorow.

I’ll update this post as soon as I have an answer…

Tags:

TechEd-Dev07: Day 2/2: Windows Communication Foundation (WCF): Building Secure, Reliable and Transacted Distributed Services

November 8, 2006 by Alex Duggleby

 

This one is going to be a short review. I spent most of the session using some new stuff I has learnt in Ingo’s last session to tackle a customer problem.

The session itself was an intermediate overview of WCF. I can’t really judge a lot of it, because my attention was mostly on my task, but every now and then I popped up to get a few interesting things.

#1 Security is enabled by default for communication

#2 You can use your own Session Token Service and Authorization Manager for WCF

The rest was about basic features that any communication framework needs (reliability, confidentiality…). See the slide for more. I wonder if there is an advanced session on the topic.

Tags:

TechEd-Dev07: Day 2/1: Hardcore .NET Production Debugging

November 8, 2006 by Alex Duggleby

 

This morning I was a little tired when I entered the CCBI conference center where Tech-Ed is being held. I started off with my usual breakfast (water + whatever is available to eat at the stands) and checked my emails. Now about two hours later, I am wide awake, my head is overflowing and I thankful that I don’t have a headache yet.

This is partly due to Mr. Ingo Rammer and his session. This past session and the Kimberly Tripp’s SQL sessions yesterday have certainly had the most impact on me from a learning curve.

He started off by telling us that the debugging tool suite available are not very user-friendly (and he wasn’t exaggerating) but they are powerfull. And oh boy they are. He tooks on a quick flight through WinDbg, MDbg, a wonderfull tool by the company he works for (Thinktecture SOSAssist – I hope it’s ok to post the link to the page, since it’s not officially released as he said, but only for friends… well all of you are my friends, so it’s kind of passing it along) and gave us an insight on how to debug the most common production errors in managed code.

You all have been in the situation, you deploy an app, run it and something happens. Until now I then went back to the dev machine, added tracing, logging (or turned on logging if there was something built in) and then tried to find the exception.

Well I certainly will have an alternative for the future by using this debugging toolset. It’s not easy to do, I saw a colleague do it once and was amazed, but I will certainly have to get into doing it, because it does save a lot of time, and in some situations even logging can’t help this is the way to go.

BTW: there is an article in the current MSDN magazine (free give-away at Tech-Ed) about adplus.vbs.

Tags:

TechEd-Dev07: Day 1/4: SQL Server 2005: Optimizing Procedural Code

November 7, 2006 by Alex Duggleby

 

So I had heard of her and her reputation and all I can say after visiting this session confirmed it all. After coming too late a few minutes, I was caught off hand because the keywords were literaly flying off the powerpoint slides.

But after a while I was swimming with the rest and learned a bunch of new stuff. I’ve never had the time (or the correct source) to dig deep into SQL server and the way it does things, basically 95% of the time you don’t need it. But it’s those 5% where you can’t and don’t want to live without the tipps and tricks such as the ones Kimberly gave on SP optimization.

I’m not going to highlight the content, because it’s just too much stuff and I have to digest it all. Basically visit her well-known site and blog.

It was a 400 track, and my colleagues were in the advanced indexing strategies which were also 400 tracks, but they were all worthwile.

So now it’s off to grab a bear and more ;)

Tags:

TechEd-Dev07: Day 1/3: 3D Graphics: Windows Presentation Foundation (WPF) or DirectX?

November 7, 2006 by Alex Duggleby

 

Holy bracket. It certainly was a fun session and not so much stuff there that I’ll be using on a day-to-day basis, but the stuff he was showing really blew my mind.

First off, I don’t play a lot of games, well actually I don’t play games at all. The last time I played was more than a year ago, and the last game I played a lot was Age of Empires 2. So my knowledge on what today’s graphic cards were capable off was minute.

The session started off with a few demos comparing WPF and DX. WPF seemes much easier even in intermediate 3d stuff. If you’re going dirty with graphics (CAD apps and so on) the statement was: use DX.

Ok, then we have Demo bashing and I mean that in a positive sense. Starting off slowly with some shader examples, quickly showing a custom coded shader and a few samples from the DX sdk. Each demo you saw was better than the last, showing then power of what GPU are capable of. And then the demo before the last demo was just amazing. A complex world with a number of spheres in it. The glass texture and any texture really just rendered out perfectly. I was amazed.

The last demo was an NVidia Demo which looked nice, but I think the sphere one just showed off the reality level much better.

So I’m now going to switch back to stuff I might just need next week ;) and run off to Kimberly Tripp’s session: “SQL Server 2005: Optimizing Procedural Code”

Tags:

TechEd-Dev07: Day 2/2: Hands on lab / Ask the Experts

November 7, 2006 by Alex Duggleby

 

So I spent session two today in the HOL and at the ATE booths. I started off with the mobile HOL sessions (Patterns&Practices) taking a look at the Composite Application Block. Now having finished the lab I’ve have received some insight into what it does, but honestly I’m not sure if I would use it. For two reasons:

1. It seems very complex and I just don’t know if the benefit weighs up the cost. I haven’t thoroughly thought through it yet, but I need to look into it a bit more.

2. I’m not sure if I want my mobile apps to be blown up by the CAB any more than then need to. You’re typically (or should I say I will typically) not code so complex UIs for mobile apps, so that the overhead caused by the CAB isn’t the best way to do it.

Well we’ll see if I come around to looking at the docs about it.

After that I met up with Jeff Wharton who was proctering the lab. He completely reversed what I had thought about the different SQL Server Editions. I must say I’m confused. After posting the name change EE -> Compact Edition this morning, Jeff corrected me and told me EE will continue to exist, but CE is just a single-license version. I was heading of the Ask the Experts but I got caught at the certification ATE where I spent a while talking to an – yes there are actually some – Microsoft Certified Architect. It’s the one I’m heading for, may take a while (10 years experience, at least 3 as an architect) and lot’s of money (~10000 USD, price is probably going to rise) but it’s worth it. I just hope the certification will continue to exist…

Now I am sitting in the session: “3D Graphics: Windows Presentation Foundation (WPF) or DirectX?” (Mainly for fun, not really for a business need… but who knows… More later)

Tags: