0

I have an object that has a parameter that is a list of integers. In order for this object to behave nicely with Entity Framework and be saved in SQL, I have a calculated property that serialises that string.

private IList<int> _ObjParameters;

public virtual IList<int> ObjParameters
    {
        get
        {

            return _ObjParameters;

        }
        set
        {
            _ObjParameters = value;
        }
    }

public string ObjParametersSerialized
    {
        get
        {
            return String.Join(";", _ObjParameters);
        }
        set
        {
            _ObjParameters = value.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries).Select(Int32.Parse).ToList();
        }
    }

This works absolutely fine and does precisely what I want it to do, as the database stores the serialized version and I can work with the list of integers in the code. The serialized string will only ever contain integers, so there's no problem..

..Except for the API documentation generator. I'm using Microsoft.AspNet.WebApi.HelpPage to automatically generate help page content from the code documentation. Somehow, for some reason, this is trying to insert 'sample string 3' as a value for ObjParametersSerialized - which obviously doesn't work and throws an error.

It also doesn't make any sense as a value, but I understand why it's doing it as it is simply seeing a typeOf(string).

How can I customise or override the HelpPage generator to provide it with a sensible value?

RamblerToning
  • 926
  • 2
  • 13
  • 28

0 Answers0