[代码] 文件编译器的实现,内部使用Stream的Compiler.(组合模式)

using System;
using System.IO;
using Skight.Arch.Domain.Containers;

namespace Skight.Arch.Presentation.Web.Core.ViewEngins.TemplateProvider
{
    [RegisterInContainer(LifeCycle.singleton)]
    public class FileCompilerImpl :FileCompiler
    {
        private Compiler internal_compiler;

        public  FileCompilerImpl(Compiler internalCompiler)
        {
            internal_compiler = internalCompiler;
        }

        protected FileCompilerImpl()
        {
        }

        public virtual  Type compile_template<T>(string path)
        {
            return internal_compiler.compile_template<T>(new FileStream(path, FileMode.Open, FileAccess.Read));
        }

        public virtual Type compile_template(string path) 
        {
           return internal_compiler.compile_template(new FileStream(path, FileMode.Open, FileAccess.Read));
        } 
    }
}