Click here to Skip to main content
15,885,365 members
Articles / Web Development / ASP.NET

Introduction to Bellevue View Engine - Part 1

Rate me:
Please Sign up or sign in to vote.
3.43/5 (4 votes)
18 Mar 2010CPOL8 min read 26K   126   10  
Prototype of a new template engine for ASP.NET MVC Framework that respects HTML and uses CSS-like syntax for model binding.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Ope.Bellevue.Resources
{
    /// <summary>
    /// Embedded resource enumeration
    /// </summary>
    public enum Resource
    {
        DebuggerStyleSheet
    }

    /// <summary>
    /// Fetches embedded resources
    /// </summary>
    public class Fetcher
    {
        /// <summary>Gets a specified embedded resource</summary>
        /// <param name="resource">The resource that shold be fetched.</param>
        /// <returns>Resource as text</returns>
        public static string Get(Resource resource)
        {
            switch (resource)
            {
                case Resource.DebuggerStyleSheet:
                    return getResourceFile("debugger.css");
            }
            throw new NotImplementedException("temp implementation");
        }

        private static string getResourceFile(string fileName)
        {
            using (var stream = typeof(Fetcher).Assembly.GetManifestResourceStream("Ope.Bellevue.Resources." + fileName))
            {
                using (var reader = new System.IO.StreamReader(stream))
                {
                    return reader.ReadToEnd();
                }
            }
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Founder OPE AG
Switzerland Switzerland
Olli is a .Net developer and architect.

He specializes in Asp.net MVC and other web technologies, XML and lately Domain Specific Languages.

Olli is originally from Finland, but currently works for his own one-man-initiative OPE AG (www.ope.ag) from Switzerland. He has over 10 years of experience as one of the founding partners and Chief Technology Officer of Quartal group of companies (www.quartal.com).

Comments and Discussions