Esempio n. 1
0
        public void OnMetadataCreated(ModelMetadata metadata)
        {
            ClientResourceItem item;

            if (this.PathEmbedded.IsNotEmpty())
            {
                if (this.Type == null)
                {
                    throw new Exception("Type cannot be null if PathEmbedded is defined");
                }
                item = new ClientResourceItem(this.Type, this.PathEmbedded, this.IsCss);
            }
            else
            {
                item = new ClientResourceItem(this.Path, this.IsCss);
            }

            if (!metadata.AdditionalValues.ContainsKey(ClientResourceAttribute.KEY))
            {
                metadata.AdditionalValues[ClientResourceAttribute.KEY] = new ResourcesRegistrator();
            }

            var rr = (ResourcesRegistrator)metadata.AdditionalValues[ClientResourceAttribute.KEY];

            rr.ResourceItems.Add(item);
        }
        public void OnMetadataCreated(ModelMetadata metadata)
        {
            ClientResourceItem item;
            if (this.PathEmbedded.IsNotEmpty())
            {
                if(this.Type == null)
                {
                    throw new Exception("Type cannot be null if PathEmbedded is defined");
                }
                item = new ClientResourceItem(this.Type, this.PathEmbedded, this.IsCss);
            }
            else
            {
                item = new ClientResourceItem(this.Path, this.IsCss);                
            }

            if (!metadata.AdditionalValues.ContainsKey(ClientResourceAttribute.KEY))
            {
                metadata.AdditionalValues[ClientResourceAttribute.KEY] = new ResourcesRegistrator();
            }

            var rr = (ResourcesRegistrator)metadata.AdditionalValues[ClientResourceAttribute.KEY];
            rr.ResourceItems.Add(item);
        }