예제 #1
0
        private Template GetTemplate(EmbeddedResource resource)
        {
            Func<TextReader> getContentReader = () => new StreamReader(resource.Assembly.GetManifestResourceStream(resource.GetResourceName()));

            return new Template(resource.GetViewName(),
                                resource.GetPath(),
                                ".",
                                findModelFromViewCollection.FindModelType(getContentReader(), resource.GetViewName()),
                                getContentReader);
        }
예제 #2
0
        private static Template GetTemplate(EmbeddedResource resource, IEnumerable <Assembly> availableAssemblies)
        {
            Func <TextReader> getContentReader = () =>
            {
                var stream = resource.Assembly.GetManifestResourceStream(resource.GetResourceName());

                return(new StreamReader(stream ?? new MemoryStream()));
            };

            return(new Template(resource.GetViewName(),
                                resource.GetPath(),
                                ".",
                                FindModelType(getContentReader(), availableAssemblies),
                                getContentReader));
        }