Featured Post

Summer Boat Restoration

The better part of this summer after work and on the weekends I spent restoring my boat.  My sister and I planned a camping trip for the nephews the weekend of August 7th and I didn’t want to go to the lake about an hour away without my boat.  Problem, the boat has been at a buddy’s lake house...

Read More

It Matters Where WCF Generates Your Proxy Class

Posted by Keith Elder | Posted in WCF | Posted on 15-08-2007

7

I just ran into a weird situation and I’m documenting it so I think I’m crazy later on.  I have the following method in a WCF service which basically returns a List<> of data contracts.

 

        public GetRuleSetsByCategoryIdResponse GetRuleSetsByCategoryId(GetRuleSetsByCategoryIdRequest request)

        {

            RuleSetLogic logic = new RuleSetLogic();

            List<RuleSet> ruleSets = logic.GetRulesByCategoryId(request.CategoryId);

            GetRuleSetsByCategoryIdResponse response = new GetRuleSetsByCategoryIdResponse();

            response.RuleSets = ContractTranslator.TranslateBetweenRuleSetDataContractAndRuleSet.TranslateRuleSetListToRuleSetDataContractList(ruleSets);

            return response;

        }

There is nothing weird or fancy about the service.  It just returns a collection of data contracts.  When I first generated the proxy for this service I added a service reference to the Winform project (right clicked project, add service reference).  The above collection of RuleSets got returned as a BindingList<RuleSetDataContract>.  To me that was weird, I had expected it to be RuleSetDataContract[].  Basically an array of objects.  It was weird but I lived with it whilst I was prototyping. 

Later as I fleshed my app out more I moved my proxy class into a C# class library all on its on.  When I generated the proxy class from a plain old C# class library class, the BindingList<RuleSetDataContract> collection was in fact replaced with an array of RuleSetDataContracts!   If someone cares to go deep on this and explain why you would get two totally different types of proxy classes generated for me I’m all ears.  Right now I’m in the coding zone and have to get done so let me leave you with my fix so I can get back to coding. 

In the end what I really wanted to deal with were generic lists (List<Object>).  Instead of using VS2005 to generate the file I shelled out to the Visual Studio command prompt and ran this command:

svcutil /d:. /noconfig /o:OrbbService.cs /r:DataContracts.dll /ct:System.Collections.Generic.List`1 http://localhost:57199/MyService.svc

Here is the break down of what these switches mean:

  • /d – working directory
  • /noconfig  – don’t generate the config file (duh)
  • /o – filename for generated code
  • /r – Used to specify assemblies that might contain types representing the metadata being imported
  • /ct – fully qualified name of the type to use as a collection data type when code is generated from schemas

By running the above command I now have everything the way I really want it with List<Object> for all of the return types.  Life is good.  I can now continue my regularly scheduled programming.

Stump Burning

Posted by Keith Elder | Posted in General | Posted on 15-08-2007

6

The other night I came in and decided I was going to burn the stumps in my yard.  I am sick of looking at them and mowing around them.  My John Deere lawn mower hates driving in circles, as does his rider.  Officially, I have waged war with stumps in my yard.  I grabbed a can of gasoline and soaked them down.  Took a match, lit it from about 10 feet back and threw it toward the stump.  POOOOOOOOF!   Instant stump burning.  Here are some pictures of my stump burning escapades.

 

This tree was killed by the hurricane.  I had to finish cutting it down about a month ago.  May it rest in peace.  Once this stump burns out, this area will become my new pit.  I’m taking some red blocks and building a wall around this area and adding a man made grill.  Instant BBQ pit.  Great for cooking dogs and burgers.  Who needs charcoal!  

IMG_2051

Smaller stump.  It didn’t have a chance but has proven to be a worthy adversary.  Turns out there is a very large hole under this stump.  I have yet to touch bottom on it. 

IMG_2052

The largest of all the stumps.  About a three feet in diameter pine tree stump.  It was also a victim of the hurricane.

 IMG_2053

 IMG_2054

image Once all said stumps have burned I will be taking my tiller and tilling the ground, leveling it, then placing some centipede sod over the top of it.  When all said and done, you’ll never have known a tree once lived there.