ComplexMovieListerFactory Class – Spring.Net

using Spring.Objects.Factory;
using System.Collections.Generic;
using System.Collections;
namespace MovieFinderTestSpring.Net
    public class ComplexMovieListerFactory : IObjectFactoryAware
        private IListableObjectFactory objectFactory;
        #region IObjectFactoryAware Members
        public IObjectFactory ObjectFactory
            set { objectFactory = (IListableObjectFactory)value; }
        public MovieLister Build()
            IDictionary allMovies = objectFactory.GetObjectsOfType(typeof(Movie));
            List<Movie> movies = new List<Movie>();
            foreach (DictionaryEntry movie in allMovies)
            ComplexMovieFinder complexMovieFinder = new ComplexMovieFinder();
            complexMovieFinder.Movies = movies;
            MovieLister complexMovieLister = new MovieLister(complexMovieFinder);
            return complexMovieLister;

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s