/// <summary>
        /// Creates a <see cref="RazorCompiledItem"/> from a <see cref="RazorCompiledItemAttribute"/>.
        /// </summary>
        /// <param name="attribute">The <see cref="RazorCompiledItemAttribute"/>.</param>
        /// <returns>A <see cref="RazorCompiledItem"/> created from <paramref name="attribute"/>.</returns>
        protected virtual RazorCompiledItem CreateItem(RazorCompiledItemAttribute attribute)
        {
            if (attribute == null)
            {
                throw new ArgumentNullException(nameof(attribute));
            }

            return(new DefaultRazorCompiledItem(attribute.Type, attribute.Kind, attribute.Identifier));
        }
Esempio n. 2
0
        protected override RazorCompiledItem CreateItem(RazorCompiledItemAttribute attribute)
        {
            if (attribute == null)
            {
                throw new ArgumentNullException(nameof(attribute));
            }

            return(new AreaRazorCompiledItem(attribute, AreaName));
        }
        public AreaRazorCompiledItem(RazorCompiledItemAttribute attr, string areaName)
        {
            Type       = attr.Type;
            Kind       = attr.Kind;
            Identifier = "/Areas/" + areaName + attr.Identifier;

            Metadata = Type.GetCustomAttributes(inherit: true).Select(o =>
                                                                      o is RazorSourceChecksumAttribute rsca
                    ? new RazorSourceChecksumAttribute(rsca.ChecksumAlgorithm, rsca.Checksum, "/Areas/" + areaName + rsca.Identifier)
                    : o).ToList();
        }