PDA

View Full Version : About the MovieFinder sample


10Ways
03-29-2005, 02:47 AM
Hi, I am new to Spring and Spring.NET and I was trying the MovieFinder sample. I created another MovieFinder(MovieFinder3) that does exactly the same thing as SimpleMovieFinder, it found the MovieFinder I created and works fine.

However, when I move my MovieFinder to another DLL, it cannot find the MovieFinder I created in the other DLL. Below is the error I get. What am I missing? Maybe I need to define something more in the .config file for external DLLs?

System.Configuration.ConfigurationException: Exception in configuration section handler (C:\Program Files\SpringNET\examples\Spring\Spring.Examples.Mo vieFinder\bin\Debug\MovieFinder.exe.config line 13) ---> Spring.Objects.FatalObjectException: Could not instantiate type [Void .ctor(System.String[])]; is it an interface or an abstract class? Does it have a no-arg constructor? ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Spring.Objects.Factory.ObjectDefinitionStoreExcept ion: Error registering object with name 'MovieFinderThree' defined in 'config [objects] line 30' : Object class [Spring.Examples.MovieFinder.MovieFinder3, MovieFinder] not found. line 30
<object name="MovieFinderThree" type="Spring.Examples.MovieFinder.MovieFinder3, MovieFinder" xmlns="http://www.springfra... ---> System.TypeLoadException: Could not load type Spring.Examples.MovieFinder.MovieFinder3 from assembly MovieFinder, Version=1.0.1914.19244, Culture=neutral, PublicKeyToken=null.

Mark Pollack
03-29-2005, 02:18 PM
Hi "10ways"

From the error message I see
<object name="MovieFinderThree" type="Spring.Examples.MovieFinder.MovieFinder3, MovieFinder"

This description says that MovieFinder3 is in the MovieFinder.exe as the example was originally written. I don't see a reference to another .dll, say a MovieFinder3 dll. You should restructure the solution so that the necessary interfaces (IMoveFinder, Move) are in the seperate DLL along with your custom implementation of MovieFinder3.

The XML would then read
<object name="MyMovieFinder" type="MyMovieFinderLibrary.MySimpleMovieFinder, MyMovieFinderLibrary" />

This will refer to the implementation contained in the MyMovieFinderLibrary.dll. (The first part of the namespace coincidentally the same name)

I've posted on the wiki (http://opensource.atlassian.com/confluence/spring/display/NET/Forum+Questions) a new MovieFinder solution that is structured in this way. That should show you the layout to organize things when you have a main program that depends on various libraries.

Cheers,
Mark

10Ways
03-29-2005, 03:08 PM
It works well, i should have asked earlier~
Now, gonna have to make my own implementation.