JsonContract Create(IJsonContractCreator contractCreator)
            {
                var contract = contractCreator.CreateJsonContract();

                if (contract.UnderlyingType == dataType)
                {
                    return(contract);
                }
                else
                {
                    var msg =
                        $"Json contract creator '{contractCreator.GetType()}' created contract of type "
                        + $"'{contract.UnderlyingType}' instead of '{dataType}'.";
                    throw new Exception(msg);
                }
            }
Example #2
0
 /// <inheritdoc />
 public IMicroContractResolverBuilder AddCreator(Type dataType, IJsonContractCreator contractCreator)
 {
     contractCreators[dataType] = contractCreator;
     return(this);
 }