public static IBlogEngine GetEngine(BlogType blogType)
        {
            switch (blogType)
            {
            case BlogType.WordPress:
                if (_wordPressEngine == null)
                {
                    _wordPressEngine = new WordPressEngine();
                }
                return(_wordPressEngine);

            case BlogType.LiveJournal:
                if (_livejournalEngine == null)
                {
                    _livejournalEngine = new LiveJournalEngine();
                }
                return(_livejournalEngine);

            default:
                if (_bloggerEngine == null)
                {
                    _bloggerEngine = new BloggerEngine();
                }
                return(_bloggerEngine);
            }
        }
        public BlogPostManager(IBlogEngine blogEngine, IBlogAccessor dbAccessor, IConfiguration config)
        {
            _blogEngine = blogEngine
                ?? throw new ArgumentNullException(nameof(blogEngine));

            _dbAccessor = dbAccessor
                ?? throw new ArgumentNullException(nameof(dbAccessor));

            _config = config
                ?? throw new ArgumentNullException(nameof(config));
        }
 public static IBlogEngine GetEngine(BlogType blogType)
 {
     switch (blogType)
     {
         case BlogType.WordPress:
             if (_wordPressEngine == null)
                 _wordPressEngine = new WordPressEngine();
             return _wordPressEngine;
         case BlogType.LiveJournal:
             if (_livejournalEngine == null)
                 _livejournalEngine = new LiveJournalEngine();
             return _livejournalEngine;
         default:
             if (_bloggerEngine == null)
                 _bloggerEngine = new BloggerEngine();
             return _bloggerEngine;
     }
 }
Exemple #4
0
 public App(IBlogEngine engine)
 {
     this.engine = engine;
 }