Welcome to MSDN Blogs Sign in | Join | Help

Partial Classes & the Service Factory

I just posted the Service Factory Hands-on Labs to the community workspace and I learned something while I was putting them together. So, I'm going to do 2 things in this post. First, I'm going to do a little cheerleading for partial classes, then I'll talk about an issue Service Factory currently has since it is related to partial classses.

As you may already know, one of the most compelling uses of partial classes is when code is being generated. The code generator will create a class with the partial keyword and any modifications will take place in a different file so the generated file can be regenerated at any time without loosing changes. What I didn't know was that you can also establish an inheritance relationship in that hand-written partial class and you can leave the other one completely untouched. For example,

MyClass.generated.cs

public partial class MyClass : IMyInterface
{
    private int foo;
    public int Foo
    {
        get { return foo; }
        set { foo = value; }
    }
}

MyClass.custom.cs

public partial class MyClass : MyBase, IYourInterface
{
    private string bar;
    public string Bar
    {
        get { return bar; }
        set { bar = value; }
    }
}

I wouldn't be surprised to find that this capability explained in the C# docs, but it was way cool to find out about it on my own. It's totally fitting when it comes to the wave of modelling, guidance automation, and related efforts and technologies coming out now. If you knew all that already and found my epiphany boring ... sorry, I just had to convey my delight.

Now I get to convey my sadness. As it turns out, we (or anyone else) didn't find this until after we ship. Don't get me wrong, it's not the end of the world ... it's not like it's going to cause your spouse to leave you ... it just forces you to write more code by hand ... until we fix it :) Basically, when you go to create the repository classes, the recipe doesn't reflect on the business entities - it's just looking at the files ... so it thinks there are 2 different classes instead of just one, which also tends to hide the members on the base class. This is what you see:

Known issue Service Factory has with business entities using multiple parts of a partial class

A little extra coding won't hurt anyone ... heck, if you check out the hands-on labs, I even show you what the extra mapping for in and out parameters looks like. We'll also be posting a fix to this issue to the community eventually.

posted by donsmith | 2 Comments
Filed Under: ,

Service Factory now available for download!

Before I get ahead of myself, which comes pretty easy for me J, here’s the link to learn more about and download the Service Factory.

Wow, I’ve been waiting 8 months to write this blog entry. After months of planning, arguing, development, sleep deprivation, testing, writing, and making sure all of that wasn’t in vain, the Service Factory has actually made it onto MSDN. Since this is MY blog, I feel like I can be more personal than the other announcements I’ve written recently. This release actually means quite a lot to me. Not only is it the first p&p deliverable I’ve been involved in from the VERY beginning, but I truly believe it will revolutionize the way organizations build services. I believe it can have this impact because the deliverable has seen a huge amount of customer and community involvement and it has a very solid future. We’ve been building the next version, which will include WCF guidance, since we started this [ASMX] release. AND we already have a good idea what the v3 will look like.

If you’re building services today and don’t know what I’m talking about, I would STRONGLY encourage you to spend some time evaluating Service Factory. Not only will it give you confidence that you are building services the right way today, but you’ll have all of the guidance you need to ensure you’re on the right track to build or migrate to WCF services in the future. I’m tellin’ ya, this is bigtime!

I’m working on some hands-on labs right now that I hope to have done within a week. This will really help you get up to speed quickly. I’ll post another entry once I’ve posted them on the community workspace. For now the webcast and the arcast should be good enough to get you started. Let me know if you have any questions.

Just Published: Service Factory ARCast

Ron Jacobs did a load of ARCasts at Tech-Ed in Boston this year. One of them was with Shy Cohen and I about the Service Factory. Well, I just got an email from Ron that he's gotten around to publishing it on Skyscrapr. I can't imagine how many of these things he has queued up that he still has to publish. Anyway, go check it out and let us know what you think. I'd like to do more of these with Ron, but I want to make sure I'm talking about the stuff you're interested in. Whadda ya think?

Service Architecture Concept Model

I'm posting this because I'm interested in your thoughts about it.

A Service Architecture Concept Model

IMPORTANT: This is just a concept illustration. I'm not encouraging anyone to accept and begin using the nomenclature used.

This is just the result of a conversation Tom and Ed and I had today about how this illustration might evolve. If something isn't clear, please leave a comment. If you've seen other illustrations or nomenclature about these things that better resonate with you, please leave a comment and tell me about them. If you have any other thoughts, ... I think you get the idea :)

How Teams Build Services

With all this talk of software factories, it's important that we understand the different ways teams will use them to build services. I talk to a lot of customers and, of course, there are several different approaches a team might choose. I hope this post will be informative, but hopefully, the comments will also identify new approaches and/or confirm the ones below.

When building a solution that involves distributed services, there are a number of things the team must build: the service interface (operations and their messages), the business logic (domain model entities and processing logic), the data access layer, the proxy/service agent that consumes the service, and the client that uses the proxy/service agent. There are also several roles in the team that perform various tasks: the solution architect, the domain expert, and the developers. I understand there is often a fine line between a solution architect and a lead developer - give me some slack here :)

In every case I've seen, the team building the client application is also the team that is building the proxy/service agent. However, that's often not the case when it comes to the service interface and the business logic. There are various approaches the architect and developers might make when building the service side (they may or may not be building the consumer(s) of the service). More often than not, the architect will define what the service interface looks like and the dev team will implement the interface. The Service Factory enables at least 2 major scenarios:

  1. Solution architect provides a baseline. This baseline is an executable, foundational starting point for the service that the dev team will build upon. Among other things, this baseline will include the service's operations and their messages, message exchange patterns, and possibly selected areas of risk that cross-cut all operations (i.e. instrumentation, security, exception management, etc). It's likely the factory will be used to build this baseline and the dev team will continue to use this (or a different) factory to build out the rest of the implementation based on the requirements set forth by the domain expert. This approach is common when there is a smaller team responsible for the services and a different team is responsible for the business logic.

  2. Solution architect provides a factory. The factory being used (i.e. Service Factory) is modified by the solution architect to include the practices and patterns that have been identified by the organization (naming conventions, framework components, cross-cutting concerns, etc) and it is deployed to the dev team. The dev team will then use the factory to build the service's interfaces and the implementation (and all layers of the application). This approach is common when the same team is building the service and its implementation.

I suspect there are variations of these and I think they would be interesting. Think about how your team builds services today. Are you happy with how the team is structured (does it work)? Are you using some form of code/config generation? Are you building baselines or a factory today and have a sense of the best way it should be used in your team(s).

Since this post was geared toward teams, I didn't talk about the single individual who is building the whole solution. I know this is also a very common scenario and, of course, factories can still be a great productivity booster and a means to provide a lot of consistency in the services being built.

If you're building Web services and you're not familiar with Service Factory, whew ... you have some catching up to do ... and just in time. Patterns & practices should be releasing to MSDN by the end of the month. Let me know if you have questions or comments?

Patterns for writing music lyrics?

Okay, you've had 8 hours to change your subscription to my work related category to avoid this kind of nonsense - times up. I'm just kidding ... I know no one actually *subscribes* to this thing :D

For those of you who don't know (and many of you don't), I'm actually a closet aspiring singer-songwriter. I have enough gear (acoustic/electric/bass/classical guitars, keyboards, drum kit, harmonicas, etc. and plenty of recording/mixing equipment) for a 4+ man band, but don't really have any aspirations to put together a band. I'd like to do it all myself, but I don't have any formal training in music. Quite a dilemma, huh? Oh well, challenges help you grow, right?

So one of the things I find the most challenging is writing song lyrics that have a compelling message/story and have the right level of transparency at the same time - yeah, and rhyming can be good too. This is most disturbing to me because I really like writing and have always kinda prided myself on my ability to write ... despite my use of non-existent words like "kinda" :)

So on the way home from work today and my brain was somewhere between work and home and I had and idea - kinda like when the chocolate fell into the peanut butter :)  I started thinking about certain questions I ask myself when I'm trying to work out a particular problem I'm having with a lyric. For example, I have a complete song I wrote about my youngest daughter, but because I wrote it without a melody in mind, I'm *really* struggling to find an appropriate melody. I started thinking that it would be a good idea to start compiling a list of these questions I can ask myself that will help me work my way out of certain problems. And then it dawned on me: Patterns.

As you may know, patterns are a type of written guidance that represent and name known solutions to recurring problems. Certainly I'm not the only [aspiring] songwriter that struggles. Certainly we must all struggle with similar challenges. Wouldn't it be awesome if there were a wiki like patternshare.org specifically for writing song lyrics. Heck, I'm sure an appropriate sister site would be one for writing the actual music ... heck, that's all music is: a bunch of patterns all glued together.

Of course I did a little searching and found nothing related. That's the funny thing about music and the Internet. Musicians aren't too forthcoming with their knowledge when there is no money being transferred their way. Don't get me wrong, there are some fantastic music-related sites on the 'net (Olav Torvund's site was the first that came to mind - wholenote.com is pretty killer too) ... I just don't see a bunch of professional (or even semi-professional) songwriters helping put together a collection of patterns that collectively represent their hard-earned years of trial and error. But I can't say that I blame them :)

posted by donsmith | 2 Comments
Filed Under:

It's not just about work anymore

For the past year or so I've been maintaining 2 blogs: my personal site (http://dev4net.com), which I was posting everything to, and this blog that I've only ever posted work related things to. Well, for the time being, I'm going to use this blog for both personal and work related posts and try not to get fired in the process :) If you're curious why, just pop over to dev4net.com and you can read why.

So, if you want to read the personal post, cool ... you don't have to do anything. If you don't, want to see the non-work-related posts, you can just subscribe to the "Work Related" category and I'll mark anything that isn't personal with that category.

posted by donsmith | 3 Comments
Filed Under:

Live Service Factory Webcast announcement

I'm going to do a webcast on the Web Service Software Factory in the morning (11am EST). The link below will work if you want to tune in and ask questions live and it should also work about 24 hours after it's over to view on demand. Hope you can tune in.

http://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032300719&Culture=en-US

[Edited July 10, 2006 11:14 AM GMT-8 (PST)]
You can find the code, deck, and demo script I used during this webcast here: http://dev4net.members.winisp.net/ServiceFactory/Webcast1Code.zip. I didn't take any extra time to make the demo script great, but used in conjunction with the webcast, it should make sense. Also, the code included here is the result of steps I walked through in the webcast, not the solutions I started with. In the coming weeks I hope to make this into a hands-on-lab with better instructions. Feedback welcome [as always].

[Edited July 12, 2006 11:03 AM GMT-8 (PST)]
The MDF file for the Coho database can be found here: http://dev4net.members.winisp.net/ServiceFactory/CohoWineryDb.zip

posted by donsmith | 3 Comments

New drop of the Web Service Software Factory available!

I could go on and on about how this new drop includes a guidance package to help you build business entities from your data model, CRUD sprocs from those same data entities and data repository classes to help you persist business entities. Becuase this drop has been updated to the latest version of GAT/GAX, I could also talk about all the new stuff like the Guidance Navigator. But rather than do this, I would rather you not spend anymore time here on my blog and just go to the Service Factory Community Workspace and download it. Be sure and let us know what you think.

posted by donsmith | 0 Comments

Service Factory: Editing (part 1)

For this installment, I'm illustrating 2 examples of what I call "level 1 changes" to a guidance package. These are the easiest kinds of changes that don't even require any code changes. I'm also using the (very improved) May community drop and you'll get to see a very small peak at the security guidance package. Cool stuff :)

File: ServiceFactory-Editing1.wmv
Length: 18:32
Size: 5.89 MB

Get Connected!

Want to hear some excellent speakers talk about the architecture of connected systems ... for FREE!? Yeah, that's what I thought. So, what are you waiting for? Get over the Kirk's blog for more information about how to sign up for the Microsoft Architect Connections in early June. Tell him Don sent you :) Stuff like this doesn't happen often enough - so don't miss it!
posted by donsmith | 0 Comments

Service Factory: Entity Translation

For the third installment I've decided to talk about the entity translation (mapping) capability of the guidance package. Specifically, this is mapping between the entities that are [de]serialized to/from the wire representation and the entities that represent the business domain model. This time I used a high-quality mic (Shure) and better software (Camtasia Studio), but WMV is still the best output format for this delivery mechanism (MP4 isn't an option). I also tried 1024 x 768 instead of 800 x 600.

File: ServiceFactory-Mapping.wmv
Length: 15:15
Size: 5.93 MB

Service Factory: Contracts

Here's the second installment of my blogcast series on Service Factory. In this one I show how to create WCF data contracts and service contracts. It's a little bigger and longer than I would have preferred, but since I was building the project (a wine rating app) from scratch, I guess that's what took longer.

File: ServiceFactory-Contracts.wmv
Length: 25:48
Size: 8:51 MB

Service Factory: A Brief Introduction

Here is the first installment of a series of blogcasts I hope to continue that are focused on the project I'm working on. This is just a quick 11 slide PowerPoint presentation that gives you the rationale and scope of the project. It's really the best place to start and it's only 15 minutes. Just ignore the cursor I forgot to move out of the way :)

File: ServiceFactory-Intro.wmv
Length: 15:23
Size: 2.14 MB

Blogcasting

Okay, this post is for me (well, I guess there is a little heads-up for you too). I found this post months and months ago and thought it was awesome (thanks jhoward). When I went looking for it today, I spent a LOT more time searching for it than I care to admit. So, for posterity's sake, this awesome how-to can be found at http://blogs.technet.com/jhoward/archive/2005/01/24/359391.aspx.

It doesn't take a rocket scientist to figure out why I was looking for this. I would like to revive this blog in a useful way. Sure, I could go on and on about the project I'm working on, but there are a lot of others doing that already. I would rather provide something else. So, if all works out, my next dozen or so entries will just be links to short blogcasts illustrating how to do specific things with the Service Factory.

Fingers crossed.

posted by donsmith | 0 Comments
More Posts Next page »