PC Review


Reply
Thread Tools Rate Thread

Do something if the parameter name is someParam

 
 
roundcrisis
Guest
Posts: n/a
 
      16th Nov 2007
Hi there:

I m trying to do something (check values) if one of the parameter in a
procedure is used, for example

let say I have the following procedures:

index(int a, string specialParam, ..)
save (string specialParam)
delete(string specialParam, string lloooo)
upstream()

basically i want to run another prooc anytime a procedure that has
specialParam as a parameter is run, and actually if this proc returns
false, then the original procedure shouldn't run
I know this is not terribly clear so please feel free to ask for
clarification
any ideas?

Thanks

 
Reply With Quote
 
 
 
 
Chris Shepherd
Guest
Posts: n/a
 
      16th Nov 2007
roundcrisis wrote:
> Hi there:
>
> I m trying to do something (check values) if one of the parameter in a
> procedure is used, for example
>
> let say I have the following procedures:
>
> index(int a, string specialParam, ..)
> save (string specialParam)
> delete(string specialParam, string lloooo)
> upstream()
>
> basically i want to run another prooc anytime a procedure that has
> specialParam as a parameter is run, and actually if this proc returns
> false, then the original procedure shouldn't run
> I know this is not terribly clear so please feel free to ask for
> clarification
> any ideas?


Just make another method and run it inside each method here.

ie:

private bool handleSpecial(string specialParam)
{ /* do stuff here */ }

then in other methods;

private void index(int a, string specialParam,..)
{
if (!handleSpecial(specialParam))
return;
}

What part are you confused about?

Chris.
 
Reply With Quote
 
roundcrisis
Guest
Posts: n/a
 
      16th Nov 2007
On Nov 16, 3:18 pm, Chris Shepherd <c...@nospam.chsh.ca> wrote:
> roundcrisis wrote:
> > Hi there:

>
> > I m trying to do something (check values) if one of the parameter in a
> > procedure is used, for example

>
> > let say I have the following procedures:

>
> > index(int a, string specialParam, ..)
> > save (string specialParam)
> > delete(string specialParam, string lloooo)
> > upstream()

>
> > basically i want to run another prooc anytime a procedure that has
> > specialParam as a parameter is run, and actually if this proc returns
> > false, then the original procedure shouldn't run
> > I know this is not terribly clear so please feel free to ask for
> > clarification
> > any ideas?

>
> Just make another method and run it inside each method here.
>
> ie:
>
> private bool handleSpecial(string specialParam)
> { /* do stuff here */ }
>
> then in other methods;
>
> private void index(int a, string specialParam,..)
> {
> if (!handleSpecial(specialParam))
> return;
>
> }
>
> What part are you confused about?
>
> Chris.- Hide quoted text -
>
> - Show quoted text -


this is a bit bigger than that
many classes involved, etc

 
Reply With Quote
 
Nicholas Paldino [.NET/C# MVP]
Guest
Posts: n/a
 
      16th Nov 2007
What you want is something like Aspect Oriented Programming, where you
could cross-cut all the methods that have a certain parameter.

Nothing like that exists for .NET right now, at least out of the box. I
believe there are some people out there working on something like this, but
I don't know how much progress was made. You could google AOP (or aspect
oriented programming) and .NET and see what comes up.

You could achieve this with creating a sink for a ContextBoundObject,
but it would require you to derive all your classes from ContextBoundObject,
as well as write the sink code. Also, all of your parameters would have to
be serializable or derive from MarshalByRefObject, and there would be a
performance hit in calling your objects as well.


--
- Nicholas Paldino [.NET/C# MVP]
- (E-Mail Removed)

"roundcrisis" <(E-Mail Removed)> wrote in message
news:4867e928-16ce-4f5b-be86-(E-Mail Removed)...
> On Nov 16, 3:18 pm, Chris Shepherd <c...@nospam.chsh.ca> wrote:
>> roundcrisis wrote:
>> > Hi there:

>>
>> > I m trying to do something (check values) if one of the parameter in a
>> > procedure is used, for example

>>
>> > let say I have the following procedures:

>>
>> > index(int a, string specialParam, ..)
>> > save (string specialParam)
>> > delete(string specialParam, string lloooo)
>> > upstream()

>>
>> > basically i want to run another prooc anytime a procedure that has
>> > specialParam as a parameter is run, and actually if this proc returns
>> > false, then the original procedure shouldn't run
>> > I know this is not terribly clear so please feel free to ask for
>> > clarification
>> > any ideas?

>>
>> Just make another method and run it inside each method here.
>>
>> ie:
>>
>> private bool handleSpecial(string specialParam)
>> { /* do stuff here */ }
>>
>> then in other methods;
>>
>> private void index(int a, string specialParam,..)
>> {
>> if (!handleSpecial(specialParam))
>> return;
>>
>> }
>>
>> What part are you confused about?
>>
>> Chris.- Hide quoted text -
>>
>> - Show quoted text -

>
> this is a bit bigger than that
> many classes involved, etc
>


 
Reply With Quote
 
roundcrisis
Guest
Posts: n/a
 
      19th Nov 2007
On Nov 16, 4:41 pm, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.com> wrote:
> What you want is something like Aspect Oriented Programming, where you
> could cross-cut all the methods that have a certain parameter.
>
> Nothing like that exists for .NET right now, at least out of the box. I
> believe there are some people out there working on something like this, but
> I don't know how much progress was made. You could google AOP (or aspect
> oriented programming) and .NET and see what comes up.
>
> You could achieve this with creating a sink for a ContextBoundObject,
> but it would require you to derive all your classes from ContextBoundObject,
> as well as write the sink code. Also, all of your parameters would have to
> be serializable or derive from MarshalByRefObject, and there would be a
> performance hit in calling your objects as well.
>
> --
> - Nicholas Paldino [.NET/C# MVP]
> - m...@spam.guard.caspershouse.com
>
> "roundcrisis" <roundcri...@gmail.com> wrote in message
>
> news:4867e928-16ce-4f5b-be86-(E-Mail Removed)...
>
>
>
> > On Nov 16, 3:18 pm, Chris Shepherd <c...@nospam.chsh.ca> wrote:
> >> roundcrisis wrote:
> >> > Hi there:

>
> >> > I m trying to do something (check values) if one of the parameter in a
> >> > procedure is used, for example

>
> >> > let say I have the following procedures:

>
> >> > index(int a, string specialParam, ..)
> >> > save (string specialParam)
> >> > delete(string specialParam, string lloooo)
> >> > upstream()

>
> >> > basically i want to run another prooc anytime a procedure that has
> >> > specialParam as a parameter is run, and actually if this proc returns
> >> > false, then the original procedure shouldn't run
> >> > I know this is not terribly clear so please feel free to ask for
> >> > clarification
> >> > any ideas?

>
> >> Just make another method and run it inside each method here.

>
> >> ie:

>
> >> private bool handleSpecial(string specialParam)
> >> { /* do stuff here */ }

>
> >> then in other methods;

>
> >> private void index(int a, string specialParam,..)
> >> {
> >> if (!handleSpecial(specialParam))
> >> return;

>
> >> }

>
> >> What part are you confused about?

>
> >> Chris.- Hide quoted text -

>
> >> - Show quoted text -

>
> > this is a bit bigger than that
> > many classes involved, etc- Hide quoted text -

>
> - Show quoted text -


thanks I m actually using monorail and I ended up using filters to
achieve this
very simple, short code and no need to repeat calls all over
It s a solution that doesnt suit everyone but works for me
Cheers

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Parameter Type/Size Property Values for VARCHAR(MAX) Stored Proc Parameter jcpc Microsoft ASP .NET 2 26th Jan 2011 11:48 AM
using a String Builder a actual parameter and LPTSTR as formal parameter in unmanaged code Tony Johansson Microsoft C# .NET 1 30th Apr 2010 03:00 AM
Parameter Form - Combo Box - Parameter Query - Report Problems SJ Microsoft Access Forms 1 13th Jul 2008 04:02 AM
Pass a parameter to a parameter query from a data access page =?Utf-8?B?TWF0dA==?= Microsoft Access Queries 10 16th Aug 2006 02:52 PM
error STOP:0x0000007B (parameter, parameter, parameter, parameter) robert35 Microsoft Access Getting Started 1 15th Dec 2004 03:28 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:46 PM.