Re: Method Design Help - delegates dont help
From: Tim Smith (timasmith_at_hotmail.com)
Date: 08/29/04
- Next message: Nick Malik: "Re: How to create a database from nothing?"
- Previous message: Ben: "Error creating DataAdapter"
- In reply to: Tim Smith: "Method Design Help - delegates dont help"
- Messages sorted by: [ date ] [ thread ]
Date: 29 Aug 2004 15:37:36 -0700
Different services. We did try reflection but didnt gain much
benefit.
We did take a step back and looked at the overall design and realized
that the resource aquisition and usage could drop to a lower layer as
so many methods only used the resource once.
thanks
timasmith@hotmail.com (Tim Smith) wrote in message news:<a7234bb1.0408251716.45057f15@posting.google.com>...
> I have 20-50 methods (C# or Java) with the following identical content
> which I wish to write only once!
>
> public SomeObjOrVoid MethodDiffSigEachTime(SomeParams p) {
> ResouceObj resObj = null;
> ResourceTrans resTran = null;
> SomeObjOrVoid returnVal = null;
> try {
> resObj = GetResource();
> resTran = resObj.StartTrans();
> // METHOD SPECIFIC CODE GOES HERE
> } catch (Exception e) {
> LogError(e);
> } finally {
> resObj.Close();
> resTran.Close();
> }
> return returnVal;
> }
>
> I tried to use reflection but I cant pass in the method name since it
> is a helper method and if I use a hard coded string (risking runtime
> types), it loses on performance and exceptions lose a lot of
> information.
>
> There must some way to design around duplicating so much code for this
> service orientated architecture...
- Next message: Nick Malik: "Re: How to create a database from nothing?"
- Previous message: Ben: "Error creating DataAdapter"
- In reply to: Tim Smith: "Method Design Help - delegates dont help"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|