Title Image

Don Xml's Grok This

The home of Don Demsak
Welcome to Don Xml's Grok This Sign in | Help
in Search

This Blog

Syndication

Site Sponsors

DonXml's All Things Techie

  •  
     

    Introducing SO-Aware – Bringing Service Oriented Awareness to the Enterprise

    So, you are a .Net developer, and you gone and built some services for your enterprise applications.  You’ve spent the time building and deploying the services. You might have written them using ASP.Net, or you went all out and built them “the right way” with WCF.  But for some reason, you are not seeing the return on investment.  Sure, your applications are more modular, and reusable, but it takes a bit more work building the services, and other applications don’t seem to be taking advantage of the services you built.  And if they are using your services, now you have to monitor them, and make sure that any changes you make will not break the other applications that use your services.

    There are a couple of things they don’t warn you about when hyping service orientation:

    • Service Configuration – If you are using WCF, a MEX endpoint will only take you so far, and WCF doesn’t make it easy to share configuration across services, easily.  .Net 4.0 is a step in the right direction, but it is still only shares bindings and behaviors within a machine.
    • Service Discoverability – You might have built a great service, but unless other applications (or developers) know about your service, they can’t use it.
    • Service Monitoring – Now that the service is out there, how do you know how often it is being used, and which operations are the most popular.  Microsoft has AppFabric, but it only goes so far, and you are not ready to make the jump to AppFabric.
    • Service Testing – Once your service becomes wildly used, how do you go about making sure that your changes, especially changes to configuration, do not break the clients using your services.

    Successful services depend on these 4 aspects of Service Orientation, but they depend on more than just developers.  Architects, other developers, testers, and operation support want visibility into them.

    So, to take full advantage of all the hard work you put into your services you need a repository to store all this info.  And not just any repository, but one that is extremely easy to use and find the information within it.  If you are an old time service developer, you might have heard about this thing call UDDI – Universal Data Discovery and Integration.  It was supposed to be the way the find out and use services, but it has proven to be incredibly complex and hard to use.  So, no one really used it.  A much easier solution would be an REST (Resource State Transfer) based service solution.  REST service tend to be much easier to use, because they are HTTP based, but because there are so many different flavors of REST implementations, discovery (querying) the data within tended to be custom for each implementation.  That is until Microsoft released OpenData (OData) as an open specification.  With OData, it becomes just as easy to query a repository as it is to consume it.

    SO-Aware does this all for you.  You can think of it as 3 separate repositories all exposed using the RESTful OData protocol. It contains:

    • Service Configuration Repository: this is where you store all your metadata about your service.  If you have a WCF service, this is where your WSDL and your bindings and behaviors are stored.  If it is an ODate service, you can put all your OData service documents here.  Or if you are using a custom ASP.Net REST service implementation, you can put the details about your service here.
    • Service Monitoring Repository: If you are using a WCF service, all the usage information about your service is stored here.
    • Service Testing Repository: We all need to make sure to test our services.  This is where you can store the service tests, and the test results.

    Sounds great, but what’s in it for you, the developer?  Well, the we all know that WCF configuration isn’t easy.  Sure, Microsoft has made it a little easier with 4.0, but you still need to fight the WCF Configuration Editor to get the Service configuration correct, and once you do that, do you really remember how to update it when you need to?  And how do you tell the  operation folks to maintain it, and deploy the configurations to the service farm?  Well that is where putting the configuration into a repository really pays off.  With SO-Aware, you get a custom Service Host Factory, which will automatically pull the latest service configuration out of the repository for you, and reconfigures the service automatically.  Need to make a change to the config, no more updating the config locally, and then trying to put a change control request into operations, or hoping that operations updates the configuration correctly, and then deploy it to all the servers.  No more trying to keep the compliance documentation in sync with what is deployed on the services.  Instead, those very same changes can be made via the SO-Aware portal, using templates built buy WCF experts, making it so much easier to maintain your WCF configurations.

    And what is even better than configuring the service?  Well that would be configuring all the clients, too.  With SO-Aware, the consumers of your services have it just as easy as you do (even easier, since odds are they know even less about WCF).  They can point their client proxies to the SO-Aware repository and automatically configure the client side WCF configuration.  Now, there is no reason for .Net developers to be afraid of consuming WCF services.  The configuration just happens for them, and they don’t even have to know about how to do it, or how to update it when it changes.  All they need is what version of the service they wish to use, and it gets automatically configured for them.

    Now that you have your services built and deployed (even to the test environment), as a good enterprise developer, you need to test the services, especially the binding and behavior configuration changes.  Well, SO-Aware has you covered there, too.  You can put your service tests into the SO-Aware Service Testing Repository via the Management Portal.  Since the configuration is in the repository, and SO-Aware is written in .Net, you can sure that your Service Testing tool works with whatever bindings and behaviors you used, no matter how customized you got them.  This is where most generic Service Testing tools fall down.  They either only support the simplest of WS-* specifications, or don’t align with the versions implemented in WCF.  With SO-Aware that isn’t the case, so you don’t have to do things like expose unsecured endpoints to work with your service testing tool.  And to make things even easier, to execute your test, since SO-Aware is RESTful, all you have to do is an http get on the url for the test, and it will execute it for you.  So, integrating into whatever testing framework or build management tool is a breeze.

    So, we have configuration and testing covered, now onto Service Monitoring.  Do you have SLAs?  Or maybe you just want to know how often your service is called, and which operations are used the most.  Or maybe you have a rogue request coming in and you want to record the request and response.  Because your services are configured to use the SO-Aware Service Host Factory to get the configuration from the repository, it can also monitor the service and asynchronously publish that information to the SO-Aware Monitoring Repository.  You can then review all this data in the SO-Aware Management Portal.

    Now you are asking yourself, this tool sounds great, but I’m not sure if my company will be willing to purchase something like this.  Maybe you’ve run across other Service Governance applications, and you got a little sticker shock.  Or, maybe you just don’t know how valuable a tool like this would be in your enterprise, so you want to try it out in production for a while first.  It really doesn’t matter, because Tellago Studios has a number of Microsoft MVPs, and we know how valuable the .Net developer community is.  So, we are giving away the Express Edition of SO-Aware.  With the Express Edition, you have a fully functioning product, that can be used in production.  It isn’t a trial version.  The only limit on the Express Edition is that you can only register five services.  That, it is it.  Well, there is one more thing.  If you do use SO-Aware Express Edition in your organization, we would love to get feedback on the product from you.  Your feedback will only serve to make future version a better product.

    To get your free SO-Aware Express Edition, please fill out the Express Edition Registration Form and we will email you an activation key along with details on how to get and install the SO-Aware Express Edition.

    Posted Wednesday, July 28, 2010 11:48 AM by donxml | 0 Comments
  •  
     

    WCF Firestarter Online Saturday 6/19/2010

    This weekend is the WCF Firestarter in New York CityRegistration to attend in person is SOLD OUT and we’re looking forward to a full house in the Big Apple on Saturday!  You can see the event agenda at Peter Laudati’s blog, as well as at MSDN Events

    WCFFirestarterNYC_1

    Firestarter events have been quite popular wherever Microsoft has hosted them around the country. Are you NOT in New York this weekend and feeling a little left out?  Don’t worry… we know there are plenty of folks who don’t live in the New York area!  That’s why we’re going to be broadcasting the WCF Firestarter event LIVE on Saturday via webcast!

    Registration is now open for the online simulcast of the WCF Firestarter.  You can log in on Saturday morning (9am US east coast time) to watch, listen, and even interact with the presenters!  The event will be broadcasting via Live Meeting (so make sure you install the client ahead of time), which will feature a live video stream, as well as a Q&A chat tool where you can ask the presenters questions.  You can also follow and participate in the conversation on Twitter using the tag: #WCFFS.

    REGISTER HERE to join online from your couch

    Posted Friday, June 18, 2010 10:33 AM by donxml | 0 Comments
  •  
     

    Microsoft PDC Workshop - Developing Microsoft BI Applications - The How and The Why

    Bringing Business Intelligence knowledge to the .Net developer crowd has been something that I’ve been trying to do over the last year.  So, when Andrew Brust offered me an opportunity to work with him on a PDC pre-conference workshop with intent of bringing some BI goodness to the PDC crowd, I couldn’t turn it down.  The workshop is called “Developing Microsoft BI Applications - The How and The Why”, and if you have seen my BI For the .Net Guy talk, you’ll have a good idea as to what attendees will be in for, only a lot more stuff covered, and even better (thanks to the help of Andrew).  We start you off assuming you haven’t done BI before (and let’s face it, .Net BI applications are not, yet, common), and bring up to speed with some of the terms and concepts of BI and OLAP, how to migrate from transactional data stores to BI data stores, and then shoe how to access them using .Net.  We then shift gears and show how to use the various BI Presentation Technologies (Reporting Service, Report Builder, Sharepoint, Performance Point, Gemini and some 3rd party tools).  The last 1/3 of the workshop is all about how to strategically integrate BI into your line of business applications (and engage your business owners/clients and show what can and can’t be done with BI).

    If you want to find out some more, Peter Laudati interviewed Andrew and myself about the workshop.  Actually, Peter jumped in and helped us (Thanks Peter!), when we couldn’t travel out to Redmond to be interviewed by Robert Hess on “The Knowledge Chamber” (that wouldn’t have been so cool, but it wasn’t meant to be :(  ).

    So, if you headed out to the PDC, signup for the workshops and register for Developing Microsoft BI Applications - The How and The Why.  Yes, I know we are in tough economic times, but the PDC is always my favorite Microsoft conference.  You get to find out about the future of the Microsoft development stack, and hangout with the uber-geeks.  I’m staying at the Westin (seems as though the bar in the lobby is always filled with great late night conversations).

    Posted Sunday, September 20, 2009 7:10 PM by donxml | 2 Comments
  •  
     

    WCF, jQuery and WebForms Slides and Code

    I’m finally getting around to publishing my slides and code for my recent user group talks on using jQuery with WCF in ASP.Net WebForms.  The latest version is from my SoCal .Net Architecture talk.  You can also see my MessageBody WCF style in this code.  Eventually I’ll publish the sample app as an open source project, since it has a couple of different uses.

    Posted Wednesday, April 22, 2009 2:47 PM by donxml | 3 Comments
  •  
     

    The Tale of WCF, MessageContract, and JSON

    Yes, I know it had been a long time since I’ve blogged, and even longer since I’ve blogged any decent technical content.  But I have a feeling that the drought is over, and a series of tech content is on the way ;)

    This is the tale of how I spent a good part of a week trying to build something “the right way” only to be reminded that “the right way” is determined by your context (which way you want to look at something).  You see, I’m an old school web service developer, and with that, teaching developers that the way to build services is to make sure not to forget that you are sending messages, not executing remote procedure calls.  Way back when, people use to argue, do you build services code first, or contract first, and I came to the conclusion that it really didn’t matter as long as you designed them Message First.  But I must not have done a good job spreading the word, because the overwhelming majority of Service code out there seems to be written in a RPC style.  It still tries to encourage the developer to write the same style code, be it a call to a function within the same App Domain, or to Service in another App Domain (or even another machine running a totally different framework).

    So here’s how this starts.  I decide that I want more “modern” look and feel to administer ASP.Net Membership, and to do that, I want to use jQuery and WCF.  Rick Strahl has done some excellent work getting jQuery and WCF JSON to work together, but like so many other examples out there, his examples use WCF’s DataContracts, and don’t implement a more explicit messaging model.  I eventually want to open source this, so I give it the project name w00ton.  I start to build out a WCF UserAdministrationService, write some integration tests (using NUnit, .Net client and host it in a Web Project), and everything is cool.  I have explicit Message, Data, and Fault contracts, in a Service Factory style (except I put them all in one project, instead of separate projects like SF does).  So here’s what the code looks like:

    The Service Interface

    namespace w00ton.MembershipAdministration.ServiceContracts
    
    {
    
        [ServiceContract(Namespace = "urn:w00ton.MembershipAdministration.ServiceContracts",
    
        Name = "UserAdministrationService",
    
        SessionMode = SessionMode.NotAllowed,
    
        ProtectionLevel = ProtectionLevel.None)]
    
        public interface IUserAdministrationService
    
        {
    
            [FaultContract(typeof(Faults.DuplicateEmailAddressFault))]
    
            [FaultContract(typeof(Faults.DuplicateUserNameFault))]
    
            [FaultContract(typeof(Faults.InvalidEmailAddressFault))]
    
            [FaultContract(typeof(Faults.InvalidUserNameFault))]
    
            [FaultContract(typeof(Faults.InvalidPasswordFault))]
    
            [OperationContract(IsTerminating = false,
    
                IsInitiating = true,
    
                IsOneWay = false,
    
                AsyncPattern = false,
    
                Action = "CreateUser",
    
                ProtectionLevel = ProtectionLevel.None)]
    
            Messages.CreateUserResponse CreateUser(Messages.CreateUserRequest request);
    
            [OperationContract(IsTerminating = false,
    
                IsInitiating = true,
    
                IsOneWay = false,
    
                AsyncPattern = false,
    
                Action = "GetAllUsersByPage",
    
                ProtectionLevel = ProtectionLevel.None)]
    
            Messages.GetAllUsersByPageResponse GetAllUsersByPage(Messages.GetAllUsersByPageRequest request);
    
        }
    
    }

    Message Contract

    namespace w00ton.MembershipAdministration.ServiceContracts.MessageContracts
    
    {
    
        [MessageContract(IsWrapped = false)]
    
        public class GetAllUsersByPageRequest
    
        {
    
            [MessageBodyMember(Name = "Body")]
    
            public GetAllUsersByPageRequestBody Body { get; set; }
    
        }
    
    }

    Data Contract

    namespace w00ton.MembershipAdministration.ServiceContracts.DataContracts
    
    {
    
        [DataContract(Namespace = "urn:w00ton.MembershipAdministration.DataContracts",
    
        Name = "GetAllUsersByPageRequestBody")]
    
        public class GetAllUsersByPageRequestBody : IExtensibleDataObject
    
        {
    
            [DataMember(Name = "PageIndex", IsRequired = true, Order = 0)]
    
            public int PageIndex { get; set; }
    
            [DataMember(Name = "PageSize", IsRequired = true, Order = 1)]
    
            public int PageSize { get; set; }
    
            #region Implementation of IExtensibleDataObject
    
            public ExtensionDataObject ExtensionData
    
            {
    
                get; set;
    
            }
    
            #endregion
    
        }
    
    }

    The code style I’m using here is something I call the MessageBody style.  I’ll have to write up that style, and why I use it in another blog post.  It’s just something I’ve developed over time that seems to work for me.

    .Net Client Test

    [TestFixture]
    
    public class GetUsersTestFixture
    
    {
    
        [Test]
    
        public void Must_Be_Able_To_Get_Users()
    
        {
    
            using (UserAdministrationServiceClient Client = new UserAdministrationServiceClient())
    
            {
    
                var Response =
    
                    Client.GetAllUsersByPage(new GetAllUsersByPageRequest
    
                    {
    
                        Body = new Data.GetAllUsersByPageRequestBody
    
                        {
    
                            PageIndex = 0,
    
                            PageSize = 10
    
                        }
    
                    });
    
                Assert.That(Response.Body.MembershipUsers != null);
    
            }
    
        }
    
    }

    So, the test works and the WCF service seems to be fine, so I decide to try to call it using ASP.Net AJAX and the code gen’d Proxy class:

    function GetAllUsersByPage(pageIndex, pageSize)
    
    {
    
        var tn = { "PageIndex": pageIndex, "PageSize": pageSize };
    
        w00ton.MembershipAdministration.ServiceContracts.UserAdministrationService.GetAllUsersByPage(tn,
    
            function(GetAllUsersByPageResponse)
    
            {
    
                alert(GetAllUsersByPageResponse);
    
            }, onPageError
    
        );
    
        function onPageError(error)
    
        {
    
            alert("An error occurred:\r\n\r\n" + error.Message);
    
        }
    
    }

    But when I test that code, it throws an error, “An Error Occured: Undefined”.  So I check out what is being sent via Fiddler.

    {"Body":{"PageIndex":0,"PageSize":5}}

    Hmm, seems like the ASP.Net AJAX proxy automagically, adds the wrapping Body property.  I didn’t put that in my JSON, ASP.Net AJAX did, and here is the complete error message:

    {"ExceptionDetail":{"HelpLink":null,"InnerException":
    
    {"HelpLink":null,"InnerException":null,
    
    "Message":"The data contract type 
    
    'w00ton.MembershipAdministration.ServiceContracts.DataContracts.GetAllUsersByPageRequestBody'
    
     cannot be deserialized because the required data members 'PageIndex, PageSize' 
    
    were not found."

    So, it seems as though the JSON Serializer isn’t expecting the wrapping Body property, and chokes because it can’t find the 2 properties in the GetAllUsersByPageRequestBody DataContract.   But I didn’t add the wrapping Body property, the ASP.Net AJAX code gen’d that in the proxy.  So to prove it, I decide to call Sys.Net.WebServiceProxy directly, instead of going thru the generated version:

    function GetAllUsersByPageDirect(pageIndex, pageSize)
    
    {
    
        var tn = { "PageIndex": pageIndex, "PageSize": pageSize };
    
        Sys.Net.WebServiceProxy.invoke('../UserAdmin.svc', 'GetAllUsersByPage', false, tn,
    
            function(GetAllUsersByPageResponse)
    
            {
    
                alert(GetAllUsersByPageResponse);
    
            }, onPageError, null, 1000
    
        );
    
    } 

    And sure enough, it works!

    So, I don’t know if I’m doing something wrong, because I’d expect that the MessageContract style would work with ASP.Net AJAX and JSON.  I’d at least expect that someone else has bumped into this issue, but I can’t seem to find a blog entry or a question on a public newsgroup or discussion list.  All I know is that I got it working with ASP.Net AJAX by skipping the code generated proxy, and that if you want to use jQuery’s AJAX  the code is just about the same as the direct call in ASP.Net AJAX (using Rick’s ServiceProxy).

    function GetAllUsersByPage(pageIndex, pageSize) {
    
        UserAdminProxy.invoke("GetAllUsersByPage",
    
                        {
    
                            PageIndex: pageIndex,
    
                            PageSize: pageSize     
    
                        }
    
                        ,
    
                        function(FindUsersByNameResponse) {
    
                            // your code here
    
                        },
    
                        onPageError);
    
    }

    Just to prove that I wasn’t going insane, I rewrote the code using just DataContracts and no MessageContracts (just using the GetAllUsersByPageRequestBody) and sure enough, you do need to wrap the properties in GetAllUsersByPageRequestBody with a property of the same name as the parameter name used in the ServiceContract (which makes total sense, because that is the way every AJAX and WCF sample is written). 

    The key to getting this to work is knowing that when using MessageContracts the WCF JSON Serializer, it doesn’t behave the same way as if you use just DataContracts.  It skips the Message and the MessageBody in both the request and the response (so do add them in or expect them in a response).

    This sample code can be found here along with a presentation on using WCF & jQuery with WebForms.

    Posted Friday, April 10, 2009 10:51 AM by donxml | 2 Comments
  •  
     

    PDC 2008 Session Calendar Synchronization Tip

    If you are attending PDC 2008, you may have noticed that on the Sessions page, if you log in, you can chose the sessions you are interested in attending, along with a link so you can add it to your favorite calendar program.  The only problem is that one of my favorite calendar programs (Google Calendar) will throw an parsing error if you try to import it.  But, Outlook 2007 doesn’t seem to have a problem with it.  So I have a solution, just use SyncMyCal.  Scott Hanselman turned me onto this inexpensive tool, and I’ve got to say, it would be hard to live without it.  One of my problems with the way that Outlook subscribes to calendar feeds is that it create a brand new calendar in Outlook, and there isn’t an easy way to merge them with you main calendar.  So, what I do use SyncMyCal to handle the merges (plus I grant my family access to my Google Calendar, so they know what I’m up to).

    So here is the setup, Outlook imports my PDC Session Calendar.  I have SyncMyCal setup to push that calendar to my main Google Calendar.  Then I have SyncMyCal merge my main Google Calendar with my main Outlook Calendar.  If I wanted to, I could have sync’d the Outlook PDC Calendar to a new Google PDC Calendar, and then pull then merge that with my main Outlook Calendar, setting the category and even labeling them with a color, but I decided that was a little much.

    Once that is done, then I can sync my Outlook calendar with my phone, and I’m all set.  Got to love technology ;)

    Posted Friday, October 24, 2008 9:35 AM by donxml | 3 Comments
    Filed under: ,
  •  
     

    Just Say No to Console App Demos

    It is a major pet peeve of mine; presenters that use Console Application Projects to demo some non-UI code.  That’s so 1990’s.  So, what should a presenter use?  Well, Test Projects, of course!  It is something that I think should be added to Scott Hanselman’s 11 Top Tips for a Successful Technical Presentation (it sort of fits under Tip # 8).  At one time, when I would approach a known speaker about using Test Projects, the typical answer was that the majority of .Net developers don’t install NUnit, and MSTest is only available in Team System, so they would be using a tool that the masses don’t use.  My reply was that more developers should be using Test Projects, and we as presenters could influence them if we would just use them in or demos.   Well, now that MSTest is now available in everything but the Express versions, that excuse is shot.  So, it comes down to old habits, and those are hard to break without a little incentive.  To provide that incentive, what I’d suggest that you do is the next time you are in a session where the presenter uses a console project to demo some code, when you fill out the eval form, leave a comment that would would prefer that they used a Test Project instead of a console application.  As a tech presenter, I really appreciate constructive comments from attendees, and I’m sure that if the presenter got enough requests to use Test Projects, they will make sure to get comfortable using them instead of console apps in their demos.

    I’ll be at PDC 2008, and I’ll be looking out for presentations that use console app demos, making sure to leave a comment in the eval.

    Posted Friday, October 24, 2008 8:51 AM by donxml | 8 Comments
    Filed under: ,
  •  
     

    Static Code Analysis and Custom FxCop Rules for Enterprise ASP.Net Development

    Over the last couple months I've been doing a bit of work with FxCop and Static Code Analysis.  If you remember playing with FxCop back in the day, it was a cool tool to check for possible design, localization, performance, and security issues with your .Net code.  But, for most of us, that's where things stopped, playing with a cool tool and then forgetting about it.  Sure, Microsoft built it into VS 2005 as Visual Studio Code Analysis, but still most developers forget about it, and never turn it on.  Well, I've been on a Continuous Integration kick for over a year now (with CruiseControl.Net or TFS 2008, depending on the client), and it is easy to an things like FxCop and NDepend to your build process.  Yes, there are a lot of pre-built rules out there, but for most of us, some of the rules are extremely valuable, but some are just annoying, and there are still a lot of personal best practices that you have developed over the years that don't have rules. 

    Well, that is where writing your own FxCop rules can come in handy.  It isn't the easiest thing to work with, since there is no official documentation of Microsoft.Cci (which is the heart and soul of FxCop).  But, Jason Kresowaty has created some helpful documentation (although not complete by any means), and he also created the extremely helpful Introspector tool to go along with spelunking assemblies using the introspection object model.  After writing a couple of my own custom rules, I figured I should poke around and see if anyone has released some FxCop rule libraries, checking out CodePlex and SourceForge, but I didn't find any.  I did find one blog post by Richard Banks on a great WCF FxCop rule example, EnsureFaultContractsAreDeclared, and sure, the Patterns & Practices team releases custom rules as part of their Software Factories, but I thought that there would be more out there.  It seems like something that would be perfect for groups like ASP Insiders, Sharepoint MVPs, Connected Systems MVPs, etc. and they could band together and come up with some good rules to go along with all the best practices we seem to come up with.

    So, I'll try to start this thing rolling, and try to put together a bunch of rules around best practices for building Enterprise-ready ASP.Net applications.  But I can't do it alone, so I'm asking the community to help me out, and either leave their own ASP.Net rules as comments, or post them up on their blog (if you have one, and link back to this post).  I'll document them, and if we get enough traction, I'll start up a CodePlex project where we can coordinate this.  Here's an example:

    Rule: EnsureAspSessionVariablesAreSerializable
    Name - Asp.Net Session variables must be marked serializable
    Description: All session variables must be marked serializable if you will be using a SessionStateMode other than inproc
    Resolution: Mark the variable to be stored in session with the Serializable attribute

    I'm sure others have similar rules, that they use implicitly, and I'd like to gather them up, put them into rule libraries and then publish them on CodePlex.

    Posted Wednesday, June 18, 2008 8:40 PM by donxml | 3 Comments
    Filed under: ,
  •  
     

    Cache Or Session State - Similar But Different

    This week at TechEd Microsoft announce the Velocity project, a distributed in-memory object caching system, which got folks like Dare and ScottW talking about using a distributed caching solution for boosting the performance of web sites. That got me thinking more about the differences between Cache and Session State.  Although they seem to be the same, and often caching solutions are used for storing session data, I'm not a big fan of putting session in a cache solution (and I really hate putting session in a relational database, since there is nothing relational about the data).  But before I describe my preferred solution, let's define the terms:

    Cache (via Wikipedia) - a cache is a collection of data duplicating original values stored elsewhere or computed earlier, where the original data is expensive to fetch (owing to longer access time) or to compute, compared to the cost of reading the cache. In other words, a cache is a temporary storage area where frequently accessed data can be stored for rapid access. Once the data is stored in the cache, future use can be made by accessing the cached copy rather than re-fetching or recomputing the original data, so that the average access time is shorter. Cache, therefore, helps expedite data access that the CPU would otherwise need to fetch from main memory.

    Session (via Wikipedia) - a session is a semi-permanent interactive information exchange, also known as a dialogue, a conversation or a meeting, between two or more communicating devices, or between a computer and user (see Login session). A session is set up or established at a certain point in time, and torn down at a later point in time. An established communication session may involve more than one message in each direction. A session is typically, but not always, stateful, meaning that at least one of the communicating parts need to save information about the session history in order to be able to communicate, as opposed to stateless communication, where the communication consists of independent requests with responses.

    HTTP session token (via Wikipedia) - A session token is a unique identifier (usually in the form of a hash generated by a hash function) that is generated and sent from a server to a client to identify the current interaction session. The client usually stores and sends the token as an HTTP cookie and/or sends it as a parameter in GET or POST queries. The reason to use session tokens is that the client only has to handle the identifier (a small piece of data which is otherwise meaningless and thus presents no security risk) - all session data is stored on the server (usually in a database, to which the client does not have direct access) linked to that identifier. Examples of the names that some programming languages use when naming their cookie include JSESSIONID (JSP), PHPSESSID (PHP), and ASPSESSIONID (Microsoft ASP).

    As the Wikipedia article mentioned, session data is usually stored in a database, which IMHO is the wrong thing to do.  So, you may think that I'd prefer to use a Distributed Cache, and Velocity does just that and lists it as one of its key features:

    Provides tight integration with ASP.NET to be able to cache ASP.NET session data in the cache without having to write it to source databases. It can also be used as a cache for application data to be able to cache application data across the entire Web farm.

    But, IMHO, using a caching engine for session, although better than a database, is still the wrong implementation for the problem.  I've mentioned before (but never in my blog), that it seems as though a message solution is a much better implementation for session data.  You see, what you are really doing when you writing some data out to session in a stateless system is sending a message to a future version of yourself.  Images of Star Trek: The Next Generation episode "Cause and Effect" come to mind.  In that episode, the Enterprise is stuck in a time loop, where it keeps get destroyed, until Data sends a message to a future version of himself, and breaks the loop.  I learned the trick of using Message Queues for Session Data back in my mainframe days, and I've found that if something scaled for the mainframe, using the same techniques on other platforms is usually the best way.  Back on the Mainframe, CICS is the transaction service used in online systems, and works in a stateless manner, very similar to the web.  To send data between each instance of a screen, one of the primary techniques is to use a Temp Storage Queue, and a queue is created for each session, based on the session id.

    I've always wanted to try to do the same thing with ASP.Net, using MSMQ as the Message Queue, but until MSMQ 4.0 (released with Vista and Win2k8 Server), it really wasn't feasible.  Creating a new queue for each ASP.Net session wasn't a simple and efficient thing to do, so I never tried it.  With MSMQ 4.0, they have added a subqueues, which are implicitly created local queues that are logical partitions of a physical queue.  This way, I can create one or more message queues for an ASP.Net application, and easily have them "indexed" by a sessionid.  The downside of using MSMQ is that very few companies have a network admin staff that know how to support MSMQ.   

    I always wondered why the ASP.Net team never released a MSMQ session provider, so I'm going to have a go at it and see what sort of perf gains I can get over using SQL Server Mode, or maybe even Out-of-process Mode.

    The first issue I've run across is that System.Messaging wasn't updated in .Net 3.5 to take advantage of MSMQ 4.0.  Reading from a subqueue is the same as reading from a regular queue, but you can't write to a subqueue using the System.Messaging namespace.  So, I'll have to implement that myself, and I'll publish the code.

    Posted Friday, June 06, 2008 5:32 PM by donxml | 6 Comments
  •  
     

    New York City IT Architect Regional Conference

    The NYC IASA chapter is holding an IT Architect Regional Conference in New York City on May 22-23 at the NYC Microsoft office.  The speaker list is quite impressive, and has a couple local Microsoft MVPs among the list (Mark Pollack, Ambrose Little and Steve Forte), along with local Microsoft Architect Evangelist, Bill Zack and Keith Pijanowski.  There is a $100 discount if you register by April 30th.

    Posted Saturday, April 26, 2008 8:49 PM by donxml | 0 Comments
  •  
     

    Mixing Object, Functional and Aspect Oriented Programming

    I spent the last week in Seattle and Redmond, attending both the MVP Summit and the ALT.Net Conference, and spent the majority of time discussing the future of programming, both on the .Net platform and other platforms.  By Saturday night, my brain was pretty much on extreme overload.  One of the things I've been doing a lot of over the last few months is pondering the effect of mixing functional programming with object oriented programming.  I've learned that functional programming twists your developer mindset.  For years, I've been using object oriented programming, and have developed the habit of thinking objects, first.  Functional programming tends to get you thinking in terms of, well, functions, first.  I've also been thinking a lot about Domain Specific Languages (both internal and external), and how they map to our traditional programming paradigms.  So, late last night, my brain popped out this little nugget:

    Within a DSL it would be cool if you could map its Nouns to Objects (described via OOP), its Verbs to Functions (described via FP), and its Adjectives and Adverbs to Aspects (via AOP).

    I have to do some research, but does this fit within the definition of a composable language?  I tried to fine a definition of what a composable language, but didn't seem to find one.

    Posted Sunday, April 20, 2008 11:57 PM by donxml | 6 Comments
  •  
     

    VSLive San Francisco Workshop - LINQ - One Query Syntax To Rule Them All

    Since I'm talking about conferences, I should also mention that I'll be giving a full day pre-conference workshop, LINQ — One Query Syntax to Rule Them All at VSLive! San Francisco 2008:

    By now you have probably already heard about LINQ and think it is all about querying SQL Server. Well, yes, with LINQ to SQL you can query SQL Server. But, LINQ is so much more. LINQ extends both C# and Visual Basic with native language syntax for queries, provides class libraries to take advantage of these capabilities, and you can even write your own query provider. In this workshop will cover the basics of how to use LINQ with in memory collections and the language constructs that make LINQ possible (for both C# 3.0 and Visual Basic 9.0). We will then explore the details of LINQ to SQL, LINQ to Entities and LINQ to XML, and even how to build your own query provider. Towards the end of the day we will go into best practices on where, when, how to use and take advantage of LINQ to SQL and LINQ to Entities. This workshop will use both C# 3.0 and Visual Basic 9.0

    It has been quite a few years since I've been to San Fran, and unfortunately I will not be there more than a couple days.  Just enough time to fly in for the workshop and have a few beers.  If you'll be there, let me know.

    Posted Monday, March 03, 2008 4:25 PM by donxml | 0 Comments
    Filed under:
  •  
     

    Devscovery 2008 - New York City April 1-3

    I can't believe it is March already.  For those of you in the New York City area, Devscovery be here, April 1st-3rd, and I'll be doing 2 talks, An Introduction to LINQ to SQL, and An Introduction to LINQ to Entities.  If you haven't heard about Devscovery, here's the details right from their FAQs

    Devscovery is a three-day multi-track in-depth technical conference produced by Wintellect. In 2008, Infragistics is collocating its user conference expanding Devscovery from 33 sessions to 55 for the same low price of just $900.

    Just check out the speakers list:

    • Andres Aguiar
    • Jason Beres
    • Roger Dahlman
    • Phil Haack
    • Scott Hanselman
    • Dennis Hurst
    • J. Ambrose Little
    • Anthony Lombardo
    • Paul Mehner
    • Jeff Prosise
    • Jeffrey Richter
    • Walt Ritscher
    • John Robbins
    • Josh Smith
    • Todd Snyder

    Not a bad little list ;)  Should be a lot of fun.

    The down side of the that list, my sessions are at the same time as Walt Ritscher and Jeff Prosise.  It will be hard for me to give a talk and try to sit in on their talks, too ;)

    Posted Monday, March 03, 2008 4:15 PM by donxml | 1 Comments
  •  
     

    Diskeeper 2008 Professional Review

    Disclaimer - the folks at Diskeeper gave me a free copy of Diskeeper 2008 Pro Premier. But, I've purchased previous versions of their product.

    I've been using Diskeeper for a couple years now, and I've got to say, I love this product.  Back before Vista was released, I had purchased and installed it on my Win XP Pro machine, and compared to the Windows Defrag utility, well, there is no comparison.  Where Windows Defrag takes forever to run, Diskeeper was finished in no time.  When I put Vista on my laptop, it was going back to the defrag dark ages until I got the new Vista ready version of Diskeeper.  Since then, they came out with Diskeeper 2008, which just keeps improving on a great tool.

    Diskeeper for Home/Home Office comes in 4 versions, Home, Pro, Pro Premier, and Home Server.  The Home Server edition is something that is going to be sorely needed, a version of a desktop utility that needs to run on a server, but not at the price of a server version.  The Home version is $29.95, and the Home Server version is $69.95, which is a very reasonable price.  When I was beta testing Home Server, one of the issues I had was the price of things like Antivirus and defrag utilities, because it is basically Windows Server, which most desktop OS utilities will not run, and the price of server versions are a lot more than what a hobbyist will want to spend.

    I have a HP 8510p notebook with Vista Ultimate installed, and Diskeeper is one of the first programs I installed.  As a developer, I tend to install and uninstall lots of programs.  Combine that with Source Control and versioning, and my harddrive tends to fragment pretty quickly, so a tool like Diskeeper keeps my drives from getting fragmented and performing up to their potential.  The only issue I have with Diskeeper (and it isn't so much of an issue with Diskeeper) is that it doesn't integrate with my Security/Anti-virus Utility of choice, Windows Live OneCare.  OneCare likes to schedule "Tune Ups", which basically consist of running things like virus scans and defrag.  The problem is that OneCare doesn't have a way to let it know that I don't use the Windows Defrag tool, and use Diskeeper instead (OneCare has the same problem with Backup Utilities).  So, it during the tune up, it tries to run the Windows Defrag Utility, which is slow, and doesn't seem to like the way Diskeeper defrags.  I also am not a big fan of the amount of time OneCare takes to scan my disk for viruses, but that is a whole other post (but OneCare is still my favorite Vista Security/Antivirus Utility).  Other than that slight issue, I love Diskeeper.  If you are a developer, or just abuse your harddrive with lots of new/updated/deleted files, Diskeeper is a must.

    Posted Monday, March 03, 2008 10:26 AM by donxml | 7 Comments
    Filed under:
  •  
     

    Petition To Get Chris Sells To Host Another SellsCon Before The End Of 2008

    M. David Peterson kickstarted the process to get Chris Sells to host another SellsCon by creating a new Facebook group.  I've got to say, the ALT.Net conference in Austin sort of reminded me of the spirit of a SellsCon (getting a bunch of bright passionate folks into one local for a couple days of deep dives and alcohol).  I'm not sure what Chris' schedule looks like for the rest of 2008, but maybe he can squeeze one in, just for old times sake.  I've only attended 2 SellCons, but I've got to say, they made a big impact in my professional life.

    If Chris throws a SellsCon, I'll be there.

    Posted Tuesday, February 26, 2008 8:38 PM by donxml | 1 Comments
    Filed under:
More Posts Next page »
Powered by Community Server, by Telligent Systems