Exemple #1
0
        internal static WithTagParser getInstance()
        {
            if (_instance == null)
            {
                _instance = new WithTagParser();
                WithTagParser.tagSplitterTemplateEngine = new TagSplitterTemplateEngine();
                List <IMyParser> myTagParsers = new List <IMyParser>();
                // Usually I will use dependency injection to run this initialization
                // But in this case, I leave it to the constructor
                IMyParser parser = null;
                // the end with tag parser
                parser = EndWithTagParser.getInstance();
                myTagParsers.Add(parser);

                // the With tag parser
                parser = WithTagParser._instance;
                myTagParsers.Add(parser);

                // the composite tag parser
                parser = CompositeTagParser.getInstance();
                myTagParsers.Add(parser);

                // the dataSource simple tag parser
                parser = BasicTagParser.getInstance();
                myTagParsers.Add(parser);
                // the C# expression language tag parser

                WithTagParser.tagSplitterTemplateEngine.MyTagParsers = myTagParsers;
            }
            return(_instance);
        }
        public TemplateEngineImpl()
        {
            // Usually I will use dependency injection to run this initialization
            // But in this case, I leave it to the constructor
            this.myTagParsers = new List <IMyParser>();
            IMyParser parser = null;

            // the With tag parser
            parser = WithTagParser.getInstance();
            this.myTagParsers.Add(parser);

            // the composite tag parser
            parser = CompositeTagParser.getInstance();
            this.myTagParsers.Add(parser);

            // the dataSource simple tag parser
            parser = BasicTagParser.getInstance();
            this.myTagParsers.Add(parser);
            // the C# expression language tag parser
        }