コード例 #1
0
        /// <exclude />
        public static XhtmlDocument Render(IDataReference dataToRender, XhtmlRenderingType renderingType)
        {
            Type dataTypeToRender = dataToRender.ReferencedType;
            IEnumerable<XhtmlRendererProviderAttribute> rendererAttributes = dataTypeToRender.GetCustomInterfaceAttributes<XhtmlRendererProviderAttribute>();

            XhtmlRendererProviderAttribute rendererAttribute = rendererAttributes.FirstOrDefault(f => f.SupportedRenderingType == renderingType);

            if (rendererAttribute == null) throw new NotImplementedException(string.Format("No '{0}' xhtml renderer found for type '{1}'",renderingType, dataTypeToRender.FullName));

            IDataXhtmlRenderer renderer = rendererAttribute.BuildRenderer();

            return renderer.Render(dataToRender);
        }
コード例 #2
0
        /// <exclude />
        public static XhtmlDocument Render(IDataReference dataToRender, XhtmlRenderingType renderingType)
        {
            Type dataTypeToRender = dataToRender.ReferencedType;
            IEnumerable <XhtmlRendererProviderAttribute> rendererAttributes = dataTypeToRender.GetCustomInterfaceAttributes <XhtmlRendererProviderAttribute>();

            XhtmlRendererProviderAttribute rendererAttribute = rendererAttributes.FirstOrDefault(f => f.SupportedRenderingType == renderingType);

            if (rendererAttribute == null)
            {
                throw new NotImplementedException(string.Format("No '{0}' xhtml renderer found for type '{1}'", renderingType, dataTypeToRender.FullName));
            }

            IDataXhtmlRenderer renderer = rendererAttribute.BuildRenderer();

            return(renderer.Render(dataToRender));
        }
コード例 #3
0
 /// <exclude />
 public static bool CanRender(Type dataTypeToRender, XhtmlRenderingType renderingType)
 {
     IEnumerable<XhtmlRendererProviderAttribute> rendererAttributes = dataTypeToRender.GetCustomInterfaceAttributes<XhtmlRendererProviderAttribute>();
     return rendererAttributes.Any(f => f.SupportedRenderingType == renderingType);
 }
コード例 #4
0
 /// <summary>
 /// Created a XHTML Renderer that uses the specified template to create markup.
 /// The key of the data will be inserted into the specified template where '{id}' is.
 /// If you spcify '{label}' the system will fetch the value of the label field and insert it.
 /// You also can use '{field:__a field name__}' syntax to insert a field value.
 /// Use '~' to create absolute paths.
 /// Example: <example>&lt;a href='~/showProduct.aspx?id={id}'>read more about {label}&lt;/a></example>
 /// </summary>
 public KeyTemplatedXhtmlRendererAttribute(XhtmlRenderingType renderingType, XhtmlRenderingEncoding renderingEncoding, string formatedTemplate)
 {
     this.FormatedTemplate   = formatedTemplate;
     _supportedRenderingType = renderingType;
     _renderingEncoding      = renderingEncoding;
 }
コード例 #5
0
 /// <summary>
 /// Created a XHTML Renderer that uses the specified template to create markup.
 /// The key of the data will be inserted into the specified template where '{id}' is.
 /// If you spcify '{label}' the system will fetch the value of the label field and insert it.
 /// You also can use '{field:__a field name__}' syntax to insert a field value.
 /// Use '~' to create absolute paths.
 /// Example: <example>&lt;a href='~/showProduct.aspx?id={id}'>read more about {label}&lt;/a></example>
 /// </summary>
 public KeyTemplatedXhtmlRendererAttribute(XhtmlRenderingType renderingType, XhtmlRenderingEncoding renderingEncoding, string formatedTemplate)
 {
     this.FormatedTemplate = formatedTemplate;
     _supportedRenderingType = renderingType;
     _renderingEncoding = renderingEncoding;
 }
コード例 #6
0
        /// <exclude />
        public static bool CanRender(Type dataTypeToRender, XhtmlRenderingType renderingType)
        {
            IEnumerable <XhtmlRendererProviderAttribute> rendererAttributes = dataTypeToRender.GetCustomInterfaceAttributes <XhtmlRendererProviderAttribute>();

            return(rendererAttributes.Any(f => f.SupportedRenderingType == renderingType));
        }