0

I'm using Configuration Section Designer (CSD) to manage my ASP.NET site services and so far I'm lovin' it. I created the section, collection and collection item (attributes only) easy. The problem is how to create 'Json' Element in the jsonWebApiService type of string. I think I need to create a custom element and converter maybe. Not sure any advice, links or ideas would be helpful. Tkanks.

Problem is View Schema https://drive.google.com/file/d/0B4oqlkkf0yHDMHo0M21PZzBZeEU/edit?usp=sharing

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <jsonWebApiSection xmlns="Web.JsonWebApi.Configuration">
        <services>
            <jsonWebApiService uniqueName="products" typeFullName="Company.Services.Products" typeAssembly="Services" route="/public/services/products.json">
                <json>{"Filter" :"OnSale"}</json>
            </jsonWebApiService>
        </services>
    </jsonWebApiSection>
</configuration>
PeeHaa
  • 71,436
  • 58
  • 190
  • 262
JBaltika
  • 1
  • 2

1 Answers1

0

You need to do following:

  1. for JsonWebApiService element set property "Has Custom Child Elements" to "true"
  2. you would also need to provide function in a separate cs file which parses that inner content:

    public partial class JsonWebApiService : ConfigurationElement
    {
        private bool HandleUnrecognizedElement(string elementName, 
                System.Xml.XmlReader reader)
        {
            /* parse your Json here */
            return true;
        }
    }
    
galets
  • 17,802
  • 19
  • 72
  • 101