I'm writing a software component which can be consumed by various .net applications. Is there anyway that the component can become aware of whether its being called by an ASP.Net Windows Forms, WPF, Silverlight application, a WCF service...?
3 Answers
About the only reason I can think of why you'd need this info is if you're encountering "Invoke" issues, where you need to be on e.g. the GUI thread of a winforms app.
If that's the reason, then this has been abstracted out by the SynchronizationContext class.
If it's some other reason, it might be helpful for us to know why you need this info. There may be a similar abstraction that has already been created to suit your needs.
2 Comments
gouldos
I'm afraid this was more of a speculative question than a specific need. The component i'm referring to provides information to the infrastrucutre framework in which it resides (similar to Environment.Context). I was trying to identify what information could be determined and exposed for other infrastrucutre components to use. For example, the location in which its running such that components could use regional specific settings, the deployment type so that the components could act differently depending if it was in test or production.
gouldos
I dont currently have a need for the calling application type, I was wondering if it was possible :o)