other assemblies.  There will be a scheduler task that creates job processes
each job will have its own job process.  Depending on a schedule xml file
different assemblies will be loaded each being their own dll.  

Travis D. Falls | Consultant   RAFT.Net   IT | 860.547.4070 |
[EMAIL PROTECTED]


-----Original Message-----
From: AspNetAnyQuestionIsOk@yahoogroups.com
[mailto:[EMAIL PROTECTED] Behalf Of Dean Fiala
Sent: Wednesday, August 17, 2005 3:56 PM
To: AspNetAnyQuestionIsOk@yahoogroups.com
Subject: Re: [AspNetAnyQuestionIsOk] Reflection Issue


Are you trying to load them from other assemblies or the executing
assembly? It's not clear how you have organized your code.

Do you have:
Controller Assembly (where IAction is defined)
Dynamic Assembly 1
Dynamic Assembly 2
Etc..
Dynamic Assembly N
where each dynamic assembly only contains a single class that
implements IAction?

You also might try using LoadFile instead of LoadFrom.  I've used that
to dynamically load classes. It's in VB but you get the idea.

  a = [Assembly].LoadFile(UpdateDir & "\" & fi.Name)
  ub = a.CreateInstance(a.GetName.Name & ".UpdaterImplementation")
  ub.Update()



On 8/17/05, Falls, Travis D (HTSC, CASD) <[EMAIL PROTECTED]>
wrote:
> That is exactly what I am trying to do; dynamically load classes.  Thanks
> for the time on GetLoadedAssemblies.
> 
> Travis D. Falls | Consultant   RAFT.Net   IT | 860.547.4070 |
> [EMAIL PROTECTED]
> 
> 
> -----Original Message-----
> From: AspNetAnyQuestionIsOk@yahoogroups.com
> [mailto:[EMAIL PROTECTED] Behalf Of Dean Fiala
> Sent: Wednesday, August 17, 2005 3:06 PM
> To: AspNetAnyQuestionIsOk@yahoogroups.com
> Subject: Re: [AspNetAnyQuestionIsOk] Reflection Issue
> 
> 
> As long as you don't have IAction defined in two separate assemblies
> or namespaces you should be fine.
> 
> The problem could be that you are actually loading the executing
> assembly (or at least IAction) twice by using LoadFrom. Can't confirm
> that because I don't have a copy of the dll you used, but it's a
> hunch. You can check what you have loaded using GetLoadedAssemblies.
> 
> If everything is one assembly, you don't need to load from the file,
> use the GetExecutingAssembly call instead. The only reason you would
> want to load the assembly from a file is if you needed to dynamically
> load a class.
> 
> 
> 
> 
> 
> On 8/17/05, Falls, Travis D (HTSC, CASD) <[EMAIL PROTECTED]>
> wrote:
> > Hey Dean,
> > Thanks for looking at that for me.  I have a quick question about your
> > response...
> > "Make sure both assemblies refer to the same definition of IAction" and
> "my
> > bet is that you have IAction defined in two places"... I don't think I
> have
> > this defined in both namespaces.  I have three files... the one with the
> > main in it which is in its own namespace and the action and action
> interface
> > in another interface... I reference this DLL in VS.net in the project
with
> > the EXE.  How can I check to see if this is defined in two different
> > locations?  Thanks again.
> >
> >
> > Travis D. Falls | Consultant   RAFT.Net   IT | 860.547.4070 |
> > [EMAIL PROTECTED]
> >
> >
> > -----Original Message-----
> > From: AspNetAnyQuestionIsOk@yahoogroups.com
> > [mailto:[EMAIL PROTECTED] Behalf Of Dean Fiala
> > Sent: Wednesday, August 17, 2005 2:18 PM
> > To: AspNetAnyQuestionIsOk@yahoogroups.com
> > Subject: Re: [AspNetAnyQuestionIsOk] Reflection Issue
> >
> >
> > Travis,
> > I was able to get this to work.  Instead of loading the assembly from
> > a file, I just loaded the executing assembly.  Your code basically
> > works, so my bet is that you have IAction defined in two places (one
> > in each assembly) and therefore you get the invalid cast exception.
> > Make sure both assemblies refer to the same defintion of IAction.
> > Might be helpful to put in a third assembly.
> >
> > private static void Main(string[] args)
> >                 {
> >                         Assembly refAsyAction
> > =Assembly.GetExecutingAssembly();
> >                         Type type =
> >
> >
refAsyAction.GetType(@"com.TheHartford.HTSC.RAFT.Reflection.Actions.ftp");
> >                         IAction myFTP =
> >
> > (IAction)refAsyAction.CreateInstance(type.FullName);
> >                         myFTP.start();
> >                 }
> >
> > On 8/17/05, Falls, Travis D (HTSC, CASD) <[EMAIL PROTECTED]>
> > wrote:
> > > I have written an attempt at reflection as I described which is listed
> > below
> > > (C#).  I am getting an error on the line IAction myFTP = .... the
error
> is
> > > listed directly below.  does anyone know how I can accomplish this?:
> > >
> > > An unhandled exception of type 'System.InvalidCastException' occurred
in
> > > ReflectionExample.exe
> > > Additional information: Specified cast is not valid.
> > >
> > >
> > > using System;
> > > using System.Reflection;
> > > using com.TheHartford.HTSC.RAFT.Reflection.Actions;
> > >
> > > namespace com.TheHartford.HTSC.RAFT.Reflection {
> > >         internal class ReflectionExample {
> > >
> > >                 public ReflectionExample() {
> > >                         init();
> > >                 }
> > >
> > >
> > >                 private void init() {}
> > >
> > >
> > >                 [STAThread]
> > >
> > >                 private static void Main(string[] args) {
> > >                         Assembly refAsyAction =
> > > Assembly.LoadFrom(@"C:\TEMP\Actions.dll");
> > >                         Type type =
> > >
> refAsyAction.GetType(@"com.TheHartford.HTSC.RAFT.Reflection.Actions.ftp");
> > >                         IAction myFTP =
> > > (IAction)refAsyAction.CreateInstance(type.FullName);
> > >                         myFTP.start();
> > >                 }
> > >
> > >         }
> > > }
> > >
> > >
> > >
> > > namespace com.TheHartford.HTSC.RAFT.Reflection.Actions
> > > {
> > >
> > >         public interface IAction
> > >         {
> > >                 string start();
> > >         }
> > >
> > >
> > >         public class ftp : IAction
> > >         {
> > >                 public ftp() {}
> > >
> > >                 public string start()
> > >                 {
> > >                         return "Is Working; FTP Start";
> > >                 }
> > >         }
> > > }
> > >
> > >
> > >
> *************************************************************************
> > > PRIVILEGED AND CONFIDENTIAL: This communication, including
attachments,
> is
> > > for the exclusive use of addressee and may contain proprietary,
> > > confidential and/or privileged information.  If you are not the
intended
> > > recipient, any use, copying, disclosure, dissemination or distribution
> is
> > > strictly prohibited.  If you are not the intended recipient, please
> notify
> > > the sender immediately by return e-mail, delete this communication and
> > > destroy all copies.
> > >
> *************************************************************************
> > >
> > >
> > >
> > >
> > >
> > > Yahoo! Groups Links
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> >
> >
> > --
> > Dean Fiala
> > Very Practical Software, Inc
> > http://www.vpsw.com
> >
> >
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >
> >
> 
> 
> --
> Dean Fiala
> Very Practical Software, Inc
> http://www.vpsw.com
> 
> 
> 
> 
> Yahoo! Groups Links
> 
> 
> 
> 
> 
> 
> 
> 
> 
> Yahoo! Groups Links
> 
> 
> 
> 
> 
> 
> 


-- 
Dean Fiala
Very Practical Software, Inc
http://www.vpsw.com



 
Yahoo! Groups Links



 



------------------------ Yahoo! Groups Sponsor --------------------~--> 
<font face=arial size=-1><a 
href="http://us.ard.yahoo.com/SIG=12h7l6kp9/M=362329.6886308.7839368.1510227/D=groups/S=1705006764:TM/Y=YAHOO/EXP=1124375173/A=2894321/R=0/SIG=11dvsfulr/*http://youthnoise.com/page.php?page_id=1992
">Fair play? Video games influencing politics. Click and talk back!</a>.</font>
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to