Tuesday, March 27, 2007

I've Moved...

I'm now posting on MSDN. Check it out here. Please update your RSS or ATOM feeds!!

Thursday, March 08, 2007

EastBay.NET Launch Event -- TONIGHT

I'll be speaking tonight on WCF in Pleasanton (a.k.a "P-town") for the EastBay.NET UG's Vista launch event along with Deborah Kurata and David Klitzke. Bring your appetites for Vista, WPF and WCF presentations as well as REAL FOOD! Yes folks, we'll have dinner tonight from Erik's Deli. :-)

For more information check this out. See you there!

Monday, March 05, 2007

Upgrade your May CTP VB LINQ Samples to Orcas March CTP

If you are playing with LINQ in Visual Basic, you'll probably want to check out Jim Wooley's post on how to convert a VB LINQ project from the May 2006 LINQ CTP to the March 2007 Orcas CTP. The syntax has changed including the order of the Order By and Select clauses. Even though it may look weird to the SQL people, there is a good reason for it, actually. Putting the Order By clause fixes a scoping issue where you now don't have to select the fields you want to order by. There's also now no need to put a := for named parameters, you can use the more normal =. Anonymous types also have a new syntax. Better intellisense should help you out. Julie also has some good information as well so check her (I mean her blog) out.

Thursday, March 01, 2007

Orcas March CTP Now Available

If you haven't seen it yet, here it is. VPC images and regular install packages are both available. (Though the specific feature list doesn't look like it's updated yet, you can read the overview.) A lot of things are finally coming together but I'm personally excited about LINQ. This CTP has the same features as the May LINQ CTP including LINQ to SQL and VB's XML literals. I'm off to download!......

Tuesday, February 20, 2007

VB WCF template in Visual Studio 2005 extensions for .NET Framework 3.0

Just an FYI to anyone that is playing with WCF 2005 extensions in Visual Basic. When you create a WCF Service Library in VB, the code for the DataContract1 class it provides does not have <DataMember()> attributes on the properties FirstName and LastName, so when you try to generate a proxy it doesn't generate correctly and the sample doesn't work.

New Project --> pick template VB/.NET Framework 3.0/WCF Service Library

You'll see that the code for the DataContract1 at the bottom of the file doesn't have any <DataMember()> attributes. This has been fixed in the Orcas CTP that's due out very soon. So for now just pop those attributes in there and then follow the rest of the directions in the template to set up a host and config files.

<DataContract()> _
Public Class DataContract1
    Private m_firstName As String
    Private m_lastName As String

    <DataMember()> _
    Public Property FirstName() As String
            Return m_firstName
        End Get
        Set(ByVal value As String)
            m_firstName = value
        End Set
    End Property

    <DataMember()> _
    Public Property LastName() As String
            Return m_lastName
        End Get
        Set(ByVal value As String)
            m_lastName = value
        End Set
    End Property
End Class

The template doesn't tell you directly how to set up a client to call it, but there is a VB example that shows you how. It's provided in the Program Files\Microsoft SDKs\Windows\6.0\Samples\ then extract the WCFSamples.zip and locate the \TechnologySamples\Basic\GettingStarted\VB\GetingStarted.sln. Here you can see a sample client and how to add the proper MetaData Exchange (mex) endpoint and service behavior so that you can generate the service proxy on the client side using "Add Service Reference" from the project menu.

If you're following the instructions in the template, to add the endpoint to the host console application you need to put this in your app.config (note, if your host is a web server then you will place this in the web.config):

<?xml version="1.0" encoding="utf-8" ?>

<!-- Stick this in here if you remove the baseAddress 
        in the StartService method it creates for you. It's a 
        good idea to change that to use this config file instead.

   <add baseAddress="http://localhost:8080/ConsoleApplicationVB/service1" />

    contract="WCFServiceLibrary1.IService1" />

<!-- Adds a WS-MetadataExchange endpoint at 
        "http://localhost:8080/SampleService/mex" -->
    contract="IMetadataExchange" />
 <behavior name="metadataSupport">

<!-- Enables the IMetadataExchange endpoint in services that
        use "metadataSupport" in their behaviorConfiguration attribute.
        In addition, the httpGetEnabled and httpGetUrl attributes publish 
        Service metadata for retrieval by HTTP/GET at the address 
        "http://localhost:8080/SampleService?wsdl" -->

  <serviceMetadata httpGetEnabled="true" />


Then start the service (this is important) and in your client select from the project menu "Add Service Reference" and put the MetaData Exchange endpoint as the service URI and it will generate the client code for you with no problems.

How to check the executing Type from the base class

Occasionally when designing base classes we need to know the type of the inheriting class executing the method (i.e. like when you're loading types from other assemblies dynamically or when it's not possible to change the inherited classes). You can either use the TypeOf operator in VB or use the GetType method that is available in the CLR to accomplish this.

Module Module1
    Sub Main()
        Dim a As New A
        Dim b As New B
        Dim c As New C
    End Sub
End Module
Public MustInherit Class Base
    Function Method1() As String

        If TypeOf Me Is A Then
            Return "Hello from A"

        ElseIf TypeOf Me Is B Then
            Return "Hello from B"

            Return String.Format("Hello from {0}", Me.GetType.ToString)
        End If

    End Function
End Class

Public Class A
    Inherits Base

End Class

Public Class B
    Inherits Base

End Class

Public Class C
    Inherits Base

End Class

Friday, February 16, 2007

SOA Facts

One of my favorite sites on the web is a Chuck Norris fact site. If you've never seen it it's hilarious. Well they now have SOA facts which is equally amusing. Enjoy!

Tuesday, February 13, 2007

Sync Services for ADO.NET

If you haven't seen it yet, the Sync Services CTP was released a couple weeks ago. Today they released the documentation and samples. The sync services for ADO.NET enable you to develop occasionally connected clients much much easier. The sync framework provides easy detection of all the types of data concurrency and conflict handling issues you encounter when developing offline clients and makes it easy to code resolutions. Best of all it uses SQLce and the deploymemt package is under 2Meg. For more information see Steve's and Rafik's blogs.

BTW, I'll be speaking at DevTeach in May on the sync services and architectures of occasionally connected clients.

Monday, February 12, 2007


In doing some more research on ADO.NET's Entity Data Model (EDM) I came across some videos here and here by Shyam Pather, Dev Lead on the ADO.NET Team. The videos are from last summer but they do a really great job of describing the EDM as a conceptual model of your data, describing properties, associations/relationships, even inheritance -- using much a richer type system to model the entities. It separates the actual normalized data schema away from your application so that when underlying schema changes happen, your application is safe as long as the entity model hasn't changed. With ADO.NET 3.0 you can write queries (with a new 'entity SQL' eSQL query syntax) against the EDM and the data access stack automatically translates them to the database -- instead of getting rows back you get entities. Of course, any changes you make can be tracked and persisted back to the database automatically for you as well.

What I really love about the ADO.NET team is that they pay attention to the backward compatibility and migration issues. What I like here is the easy migration path of current code by using the new Mapping Provider (instead of the Sql Provider). The provider is different but the key is that you can use the connections, commands, readers, etc. in the same manner as you are accustomed to. However if you are writing new code you can create a strongly-typed query using the new Query class that returns the objects instead.

This is all really really really great, however, I'm not too jazzed about learning yet another query syntax just to query these entities. Here's where LINQ comes in. You can query the EDM directly with LINQ, (very similar to how DLinq looks, actually). Let's take a couple examples. Here's how you would access data today:

Using cnn As New SqlConnection(MyConnectionString)
    Using cmd As SqlCommand = cnn.CreateCommand()
        cmd.CommandText = "SELECT Employee.Name, Region.Name " & _
                "FROM SalesPeople " & _
                "INNER JOIN Employees ON SalesPeople.EmployeeId = Employees.EmployeeId " & _
                "INNER JOIN Region ON SalesPeople.RegionId = Region.RegionId"

        Using dr As SqlDataReader = cmd.ExecuteReader()
            'Process DataReader.....
        End Using
    End Using
End Using

Say I created an EDM with an entity called SalesPeople, here's what the query could look like using Entity SQL (eSQL):
Using cnn As New MapConnection(MyConnectionString)
    Using cmd As MapCommand = cnn.CreateCommand()
        cmd.CommandText = "SELECT Name, Region FROM SalesPeople"

        Using dr As IDataReader = cmd.ExecuteReader()
            'Process DataReader.....
        End Using
    End Using
End Using

Finally (using the same EDM) here's what it could look like with LINQ:
Using edm as New MyModel()
    Dim sales = From s In edm.SalesPeople Select s
    For Each person As SalesPerson In sales
        'Do something with the SalesPerson objects

End Using

All this makes me think... why do we need DLinq (LINQ to SQL) at all? Hmmmmmmm????? Seriously.

Sunday, February 11, 2007

The History and Future of ADO

If you haven't seen it, Mike Pizzo, an Architect for Data Programmabilty at Microsoft, has a series of blog posts describing the interesting history and evolution of ADO into what it is today.

In his last post he describes the Entity Data Model (EDM) and how client views are exposed through an ADO.NET data provider extended to support a query tree representation. He also explains what happened to ObjectSpaces, which I found particularly interesting. He goes on explaining how LINQ is supported in the Entity Framework (ADO vNext) and that they both will be featured together in the next Orcas CTP (due in Feb/March). One thing that I asked Mike is what kind of guidance can he give on using EDM over DLinq and when we can see tooling for EDM in Visual Studio.

This next Orcas CTP is very exciting because it will have all the pieces finally together. LINQ, ADO vNext, and WPF tooling are my personal interests.

Monday, February 05, 2007

Ready for a New Day?

I attended the Vista Launch event at Moscone Center in SF on Tuesday. It was a large event but nothing compared to the Visual Studio 2005 launch that was here back in November 2005.
The first debacle of the day was that the event details and announcements all pointed you to Moscone West (same building where the VS launch was held) but it turned out the doors were locked and not even one poster was on the wall inside. I was standing around with a few other scratching heads thinking "Where's the 'Wow'?" Finally a guard came to the window and told us the event was taking place in Moscone North. So all morning you had large groups of nerds walking across 4th street over to the Moscone North entrance.
The main launch for Vista was in New York City and looked huge but in SF they still had both Moscone North and South halls dedicated to three separate IT Pro tracks, one Developer track and one Decision Maker track. I helped out with the Ask the Experts area and in between that I popped into a couple sessions on the Developer track.
SF wasn't cool enough to get BillG or Balmer for the keynote, instead it was done by Jeff Raikes, President Microsoft Business Division. He presented a lot of business cases for moving to Vista and had people demo the new OS as well as Office 2007 showcasing the new task oriented interfaces. My personal high point of the keynote was when he introduced the CEO of Sierra Nevada Brewing Company to discuss how Vista has made his QA department more productive (so that they can drink more beer, of course).
Among the local developer evangelists and Microsoft presenters, Juval Lowy, Deborah Kurata, Scott Stanfield also presented the new technologies in Fx 3.0, giving demos on Windows Presentation Foundation, Windows Communication Foundation and Windows Workflow Foundation. I also caught Nima Dilmaghani (local evangelist and all around nice guy) presenting on the new SharePoint integration. All in all it was an informative track for developers to get a taste of what is possible with Windows Vista and Office 2007. I assume it was equally beneficial for the IT pros (comments anyone?). I recommend attending a launch in your area. [UPDATE: I forgot to mention for filling out session evaluations, attendees received a free copy of Office 2007. So if anything else, it's worth it to attend just for that.]

Wednesday, January 10, 2007

I've Been Tagged! Five things about me....

Okay, I suppose I can't ignore this anymore since both Markus and Sam tagged me this week. It was only inevitable I suppose. Okay so here it goes -- five things you didn't know about me.

1. I'm a car fanatic and I have a 2003 Subaru WRX-ESX Stage 4 built by EasyStreet and Gruppe-S. Once in a while I race it at Sacramento Raceway. It does a 12.7 quarter mile. Next project is a rear swaybar, endlinks and a new clutch :-)

2. I used to race mountain bikes, now I just ride them. I have a 2003 Specialized FSR-Disc. I love to ride many of the thousands of miles of trails on Mt. Diablo. We have a beautiful view of the mountian from our bedroom.

3. I have an XBox 360 and I am addicted to any car/motorcycle games. I play almost every night if I'm not watching Battlestar Galactica DVDs. We just got my dad who's retired an XBox 360 for Christmas so I'm hoping he sets it up and gets his online profile so I can kick his butt.

4. I love wine and beer to the point where we're considering building a wine cellar. Exposure to great wines is easy living in the Bay Area. We go to festivals once or twice a month, even in the winter. This weekend we're headed to the 15th Annual Winter Wineland. I also belong to World Beer Direct's Beer of the Month Club where they send me three bottles each of two different international beers and two different American microbrews to my door every month.

5. I'm a pro Baseball and Football fan (it goes well with the beer :-)). I'll watch college football this time of year for the bowl games (Holy Crap, Boise State!). We have season tickets to the Oakland A's and we're considering going to spring training in phoenix this year. I'm an Oakland Raider fan too but that's a little bit embarrassing to say right now! I've been a Raider fan since they won the 1984 superbowl when I was 12 years old. My family lived in the Los Angeles area (San Pedro) back then.

Okay now for the lucky winners who get tagged by me!

- Rod Paddock
- Duffy
- Eric Newcomer
- Bill McCarthy