Provide azure specific JSON ignore attribute
I had a need to ignore properties from the search index (and not defining it as a field threw an error). The provided way to do that is a JsonIgore attribute, but in this instance I also needed to serialize the object for something else where I did need those properties.
I worked around it by creating another azure search specific class and projecting to that, but it's a bit painful.
Having an AzureSearchJsonIgnore attribute would mean I could use it without interfering with the rest of my code.
The latest version of the .NET SDK (1.0.1-preview) allows for custom serialization via JSON.NET’s JsonConverter and IContractResolver mechanisms. These should be powerful enough to implement your own custom “JsonIgnore” attribute. Examples are available in the SDK tests on GitHub. See the “CanIndexAndRetrieveModelWithExtraProperties” test for details: https://github.com/Azure/azure-sdk-for-net/blob/AutoRest/src/Search/Search.Tests/Tests/IndexingTests.cs
Bruce Johnston - MSFT commented
This is definitely something we want to address. I've added an issue on GitHub to track it: https://github.com/Azure/azure-sdk-for-net/issues/1259