Пример #1
0
        private static void TestFactory()
        {
            Console.WriteLine("Test Factory!");
            var         middlewareFactory = new MiddlewareFactory();
            IMiddleware middleware        = middlewareFactory.GetMiddleware((int)CommonObj.SQLEnum.SQLServer);

            middleware.DoAction();
            middleware = middlewareFactory.GetMiddleware((int)CommonObj.SQLEnum.MySQL);
            middleware.DoAction();
        }
        public static void Main()
        {
            var         middlewareFactory = new MiddleFactory();
            IMiddleware middleware        = middlewareFactory.GetMiddleware(1);

            middleware.DoAction();

            middleware = middlewareFactory.GetMiddleware(2);
            middleware.DoAction();
        }
Пример #3
0
        static void main(string[] args)
        {
            var         middlewayFactory = new MiddlewareFactory();
            IMiddleware middleware       = middlewayFactory.GetMiddleware(1);

            middleware.DoAction();
            middleware = middlewayFactory.GetMiddleware(2);
            middleware.DoAction();
            Console.Read();
        }
Пример #4
0
        static bool TestFactoryPattern()
        {
            Console.WriteLine("TESTING THE FACTORY DESIGN PATTERN: ");

            var middlewareFactory = new MiddlewareFactory();

            IMiddleware middleware = middlewareFactory.GetMiddleware(1);

            middleware.DoAction();

            middleware = middlewareFactory.GetMiddleware(2);

            middleware.DoAction();

            return(true);
        }