473,395 Members | 1,401 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Seamless Wrapper

Hi,
In our application, we acess a around many external data sources ranging
from sql to file shares. The code base is huge and been there for a while.

What I would like to achieve is:

Say, currently I call function foo once.
I would like to wrap this in a function say foowrap...which tries to invoke
the function x times before throwing up. Something like

void foo(){}

void foowrap()
{
for(int i=0;i<PolicyLimit;++i)
try
{
foo();
break;
}
catch(Exception e){}
}

The wrapper should be able to take any no of parameters and return the type
of the wrapped.

I have a working example, below

delegate void MyDelegate<T>(T a);

static class Robust<T>

{
public static void Invoke(MyDelegate<TmyDelegate, T param)
{
for (int i = 0; i < 10; ++i)

try
{
myDelegate(param);
break;
}
catch (Exception e){}
}
}

class Program
{
static void H(int k)
{
Console.WriteLine("Hello World");
}

static void Main(string[] args)
{
Robust<int>.Invoke(H, 7);
}
}

Please tell me, what would be the best way to go? AOP?

::Rajiv
Apr 13 '07 #1
0 967

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Egil M?ller | last post by:
Is there any way to create transparent wrapper objects in Python? I thought implementing __getattribute__ on either the wrapper class or its metaclass would do the trick, but it does not work for...
16
by: Peter Maas | last post by:
The XHTML file below creates a 2x2 matrix of square images. There is always some space at the bottom borders of the cells (when rendered with Gecko and KHTML, not with IE) and I've found no way so...
1
by: Bennett Haselton | last post by:
One of the most convenient features of Visual Studio .Net and ASP.Net is being able to add rows to a SQL Server database in an intellisense-safe way, with code like: ...
0
by: Joe Rigley | last post by:
Hi, I'm a little new to ASP Dotnet, but have been coding in classic ASP for over 5 years... I'd appreciate some suggestions/guidance in writing an Intranet login page that authenticates...
0
by: Just D. | last post by:
Does anybody know how to create a seamless frameset? If I try to use a right click on the form in .NET IDE it breaks the whole form, even if I can get the checkbox "Seamless" checked it actually...
1
by: Crirus | last post by:
Hi! I have a seamless image drawn onto a PictureBox. I wrote a mouseMove handle that allow me to drag the image around in that pictureBox. I whould like to do this When the border of the image...
16
by: utab | last post by:
Dear all, In programming terminology, what is a wrapper and where is it used? Regards
0
by: =?Utf-8?B?UmFqaXYgRGFz?= | last post by:
Hi, In our application, we acess a around many external data sources ranging from sql to file shares. The code base is huge and been there for a while. What I would like to achieve is: Say,...
0
by: Morgan Cheng | last post by:
I have one webservice written in MC++, which uses another native DLL deployed in %webservice_install_dir%\bin folder. The API invocation between MC++ and native C++ looks seamless. The compilation...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.