A class that provides a list of movies directed by a particular director.
示例#1
0
        public static void Main()
        {
            try
            {
                IApplicationContext ctx = ContextRegistry.GetContext();

                #region Advanced: Call alternative ways to create application context
                //CreateContextMixXmlAndProgrammatic();
                //CreateContextProgrammatically();
                //CreateContextProgrammaticallyWithAutoWire();
                #endregion

                MovieLister lister = (MovieLister)ctx.GetObject("MyMovieLister");
                Movie[]     movies = lister.MoviesDirectedBy("Roberto Benigni");
                LOG.Debug("Searching for movie...");
                foreach (Movie movie in movies)
                {
                    LOG.Debug(
                        string.Format("Movie Title = '{0}', Director = '{1}'.",
                                      movie.Title, movie.Director));
                }
                LOG.Debug("MovieApp Done.");
            }
            catch (Exception e)
            {
                LOG.Error("Movie Finder is broken.", e);
            }
            finally
            {
                Console.WriteLine();
                Console.WriteLine("--- hit <return> to quit ---");
                Console.ReadLine();
            }
        }
示例#2
0
        public virtual MovieLister MyMovieLister()
        {
            MovieLister movieLister = new MovieLister();

            movieLister.MovieFinder = FileBasedMovieFinder();
            return(movieLister);
        }
        public static void Main()
        {
            try
            {
                IApplicationContext ctx = ContextRegistry.GetContext();

                MovieLister lister = ctx.GetObject <MovieLister>();
                Movie[]     movies = lister.MoviesDirectedBy("Roberto Benigni");
                LOG.Debug("Searching for movie...");
                foreach (Movie movie in movies)
                {
                    LOG.Debug(
                        string.Format("Movie Title = '{0}', Director = '{1}'.",
                                      movie.Title, movie.Director));
                }
                LOG.Debug("MovieApp Done.");
            }
            catch (Exception e)
            {
                LOG.Error("Movie Finder is broken.", e);
            }
            finally
            {
                Console.WriteLine();
                Console.WriteLine("--- hit <return> to quit ---");
                Console.ReadLine();
            }
        }
 public virtual MovieLister MyMovieLister()
 {
     MovieLister movieLister =  new MovieLister();
     movieLister.MovieFinder = FileBasedMovieFinder();
     return movieLister;
 }