Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / August 2007

Tip: Looking for answers? Try searching our database.

substituting a framework method

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
lioxa - 30 Aug 2007 11:03 GMT
Hi,

I need to substitute a method of a Framework built-in class with my
own. Please suggest a way how I can do this (without having to copy/
paste whole source of a particular assembly).

Reflection, probably?

Alexei.
Patrice - 30 Aug 2007 11:52 GMT
Telling us what you are trying to do could hep to raise better suggestions
(for example my first thought would be to just wrap the needed functionality
into my own function but as we don't know what you are trying to do I'm not
sure why the "substitute a method" requirement is needed)...

---
Patrice

> Hi,
>
[quoted text clipped - 5 lines]
>
> Alexei.
lioxa - 30 Aug 2007 12:22 GMT
I need to alter functionality of Remoting TcpChannel. I cannot access
target class (transport sink) because it is 'internal'. And
SetupChannel method of TcpChannel class (which I would override to
create my own transport sink, instead of default sink it creates) is
private.

Substituting couple private methods  from internal Remoting assembly
classes with my own would help. :)

> Telling us what you are trying to do could hep to raise better suggestions
> (for example my first thought would be to just wrap the needed functionality
[quoted text clipped - 16 lines]
>
> > Alexei.
Patrice - 30 Aug 2007 13:00 GMT
Not familiar but I gave a look and saw that you can apparently use a
contructor to which you can provide your own sink provider as a
IClientChannelSinkProvider, IServerChannelSinkProvider.

If methods are internal and it doesn't fit you are basically stuck with
recompiling your own version (or you could have a look at WCF that could
offer more flexibility depending on your overall goal).

Good luck.

---
Patrice

>I need to alter functionality of Remoting TcpChannel. I cannot access
> target class (transport sink) because it is 'internal'. And
[quoted text clipped - 28 lines]
>>
>> > Alexei.
lioxa - 30 Aug 2007 14:23 GMT
Thanks for suggestions, but first isnt possible (transport sinks are
hardcoded), and second (WCF) is .NET 3.0 - I'd prefer to stick to
2.0.

I'm almost sure that with enough permissions I can do what I need -
substitute a framework clas/method with my own (of course in
particular framework instance loaded into my process).

Initial question was - how. :) I see an example in MSDN on how to
attach my own method to any class in runtime (using Reflection),
probably someone familiar with this subject can give me a clue how to
substitute existing method.

> Not familiar but I gave a look and saw that you can apparently use a
> contructor to which you can provide your own sink provider as a
[quoted text clipped - 44 lines]
>
> >> > Alexei.
lioxa - 30 Aug 2007 12:25 GMT
I need to alter functionality of Remoting TcpChannel (in particular,
its transport sink), which is implemented in 'internal' classes and
'private' methods.

Substituting couple classes or methods in this assembly with my own
would help. :)

> Telling us what you are trying to do could hep to raise better suggestions
> (for example my first thought would be to just wrap the needed functionality
[quoted text clipped - 16 lines]
>
> > Alexei.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.