本文整理汇总了C#中IContractResolver类的典型用法代码示例。如果您正苦于以下问题:C# IContractResolver类的具体用法?C# IContractResolver怎么用?C# IContractResolver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IContractResolver类属于命名空间,在下文中一共展示了IContractResolver类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CustomJsonConverter
/// <summary>
/// default constructor with contract resolver
/// </summary>
/// <param name="resolver"></param>
public CustomJsonConverter(IContractResolver resolver)
{
if (resolver == null)
throw new ArgumentNullException("resolver");
ContractResolver = resolver;
}
开发者ID:changLiuUNSW,项目名称:BDSystem,代码行数:11,代码来源:CustomJsonConverter.cs
示例2: CypherQuery
public CypherQuery(
string queryText,
IDictionary<string, object> queryParameters,
CypherResultMode resultMode,
IContractResolver contractResolver = null)
: this(queryText, queryParameters, resultMode, CypherResultFormat.DependsOnEnvironment, contractResolver)
{
}
开发者ID:Readify,项目名称:Neo4jClient,代码行数:8,代码来源:CypherQuery.cs
示例3: SetContractResolver
protected void SetContractResolver(IContractResolver contractResolver)
{
_contractResolver = contractResolver;
var cluster = ClusterHelper.Get();
cluster.Configuration.DeserializationSettings.ContractResolver = contractResolver;
cluster.Configuration.SerializationSettings.ContractResolver = contractResolver;
}
开发者ID:sebgriffiths,项目名称:Linq2Couchbase,代码行数:8,代码来源:N1QLTestBase.cs
示例4: JsonNetResult
public JsonNetResult(Object jObject, IContractResolver contractResolver, params JsonConverter[] converters)
{
_jObject = jObject;
_contractResolver = contractResolver;
_converters = converters;
}
开发者ID:altaricka,项目名称:vDesign,代码行数:8,代码来源:JsonNetResult.cs
示例5: JsonNetMemberNameResolver
public JsonNetMemberNameResolver(IContractResolver contractResolver)
{
if (contractResolver == null)
{
throw new ArgumentNullException("contractResolver");
}
_contractResolver = contractResolver;
}
开发者ID:baoduy,项目名称:Linq2Couchbase,代码行数:9,代码来源:JsonNetMemberNameResolver.cs
示例6: JsonContent
/// <summary>
/// Constructorul principal care seteaza variabila readonly _responseValue serializata in metoda SerializeToStreamAsync si optional si contractResolver folosit pentru serializare
/// </summary>
/// <param name="responseValue">Obiectul care va fi serializat si scris in Stream de metoda SerializeToStreamAsync</param>
/// <param name="contractResolver">Daca parametrul este null sau nespecificat se foloseste o instanta noua de tip DefaultContractResolver</param>
public JsonContent(object responseValue, IContractResolver contractResolver = null)
{
_responseValue = responseValue;
if (contractResolver == null)
contractResolver = new DefaultContractResolver();
_contractResolver = contractResolver;
Headers.ContentType = new MediaTypeHeaderValue("application/json");
}
开发者ID:gommjabbar,项目名称:sync,代码行数:14,代码来源:JsonContent.cs
示例7: JsonValue
public JsonValue(IContractResolver resolver, object value)
{
if (value != null && !IsPrimitive(resolver, value.GetType()))
{
throw new ArgumentException("value must be a primitive recognized by Json.NET", "value");
}
_getValue = t => value;
}
开发者ID:paultyng,项目名称:FluentJson.NET,代码行数:9,代码来源:JsonValue.cs
示例8: SetContractResolver
protected void SetContractResolver(IContractResolver contractResolver)
{
_contractResolver = contractResolver;
var cluster = ClusterHelper.Get();
#pragma warning disable CS0618 // Type or member is obsolete
cluster.Configuration.DeserializationSettings.ContractResolver = contractResolver;
cluster.Configuration.SerializationSettings.ContractResolver = contractResolver;
#pragma warning restore CS0618 // Type or member is obsolete
}
开发者ID:akorczynski,项目名称:Linq2Couchbase,代码行数:10,代码来源:N1QLTestBase.cs
示例9: HypermediaMediaTypeFormatter
/// <summary>
/// Constructor.
/// </summary>
/// <param name="name">The friendly name of the format.</param>
/// <param name="mediaTypeName">The correct media type name for content negotiation.</param>
/// <param name="contractResolver">The resource contract resolver used to resolve the contracts at runtime.</param>
protected HypermediaMediaTypeFormatter(string name, string mediaTypeName, IContractResolver contractResolver)
{
ContractResolver = contractResolver;
SupportedMediaTypes.Clear();
SupportedMediaTypes.Insert(0, new MediaTypeHeaderValue(mediaTypeName));
MediaTypeMappings.Clear();
MediaTypeMappings.Add(new QueryStringMapping("$format", name, mediaTypeName));
}
开发者ID:cosullivan,项目名称:Hypermedia,代码行数:16,代码来源:HypermediaMediaTypeFormatter.cs
示例10: SqLiteConfig
public SqLiteConfig(
string databaseName,
bool storeDateTimeAsTicks = true,
IBlobSerializer serializer = null,
IContractResolver resolver = null)
{
DatabaseName = databaseName;
StoreDateTimeAsTicks = storeDateTimeAsTicks;
BlobSerializer = serializer;
}
开发者ID:cyrilcathala,项目名称:MvvmCross-Plugins,代码行数:11,代码来源:SqliteConfig.cs
示例11: Build
private static JsonConverter Build(Type type, Func<object, IEnumerable<object>> linkEnumerator, IContractResolver contractResolver)
{
var enumerable = type.GetInterface(typeof (IEnumerable<>).FullName);
if (enumerable != null)
{
return Build(enumerable.GetGenericArguments().Single(), linkEnumerator, contractResolver);
}
var concreteType = typeof(LinkConverter<>).MakeGenericType(type);
var newMethod = concreteType.GetMethod("New", BindingFlags.Static | BindingFlags.Public);
return (JsonConverter)newMethod.Invoke(null, new object[] {linkEnumerator, contractResolver});
}
开发者ID:nordbergm,项目名称:Simple.Web,代码行数:11,代码来源:LinkConverter.cs
示例12: SwaggerGenerator
public SwaggerGenerator(
IApiExplorer apiExplorer,
IContractResolver jsonContractResolver,
IDictionary<string, Info> apiVersions,
SwaggerGeneratorOptions options = null)
{
_apiExplorer = apiExplorer;
_jsonContractResolver = jsonContractResolver;
_apiVersions = apiVersions;
_options = options ?? new SwaggerGeneratorOptions();
}
开发者ID:shaunparsloe,项目名称:Swashbuckle,代码行数:11,代码来源:SwaggerGenerator.cs
示例13: SQLiteConnectionString
public SQLiteConnectionString(string databasePath, bool storeDateTimeAsTicks,
IBlobSerializer serializer = null,
IContractResolver resolver = null)
{
ConnectionString = databasePath;
StoreDateTimeAsTicks = storeDateTimeAsTicks;
DatabasePath = databasePath;
Serializer = serializer;
Resolver = resolver ?? ContractResolver.Current;
}
开发者ID:jamesottaway,项目名称:SQLite.Net-PCL,代码行数:11,代码来源:SQLiteConnectionString.cs
示例14: Add
private static void Add(Type type, IList<JsonConverter> converters, HashSet<Type> knownTypes, Func<object, IEnumerable<object>> linkEnumerator, HashSet<Type> done, IContractResolver contractResolver)
{
if (knownTypes.Contains(type))
{
converters.Add(Create(type, linkEnumerator, contractResolver));
}
done.Add(type);
foreach (var property in type.GetProperties().Where(p => (!Ignore(p.PropertyType)) && (!done.Contains(p.PropertyType))))
{
Add(property.PropertyType, converters, knownTypes, linkEnumerator, done, contractResolver);
}
}
开发者ID:nordbergm,项目名称:Simple.Web,代码行数:12,代码来源:LinkConverter.cs
示例15: NewtonsoftJsonSerializer
/// <summary>
/// Initializes a new instance of <see cref="NewtonsoftJsonSerializer"/> with a set of custom <see cref="JsonConverter"/> instances to be used by <see cref="ConverterContractResolver"/>.
/// </summary>
/// <param name="contractResolver">The underlying JSON.NET contract resolver.</param>
public NewtonsoftJsonSerializer(IContractResolver contractResolver)
{
Serializer = new JsonSerializer
{
ContractResolver = contractResolver,
DateFormatHandling = DateFormatHandling.IsoDateFormat,
MissingMemberHandling = MissingMemberHandling.Ignore,
DefaultValueHandling = DefaultValueHandling.Ignore,
NullValueHandling = NullValueHandling.Ignore,
TypeNameHandling = TypeNameHandling.Auto
};
}
开发者ID:SparkSoftware,项目名称:infrastructure,代码行数:16,代码来源:NewtonsoftJsonSerializer.cs
示例16: InitializeCluster
protected void InitializeCluster(IContractResolver contractResolver = null)
{
if (contractResolver != null)
{
_contractResolver = contractResolver;
}
var config = TestConfigurations.DefaultConfig();
config.DeserializationSettings.ContractResolver = _contractResolver;
config.SerializationSettings.ContractResolver = _contractResolver;
ClusterHelper.Initialize(config);
}
开发者ID:sebgriffiths,项目名称:Linq2Couchbase,代码行数:12,代码来源:N1QLTestBase.cs
示例17: ObjectAdapter
/// <summary>
/// Initializes a new instance of <see cref="ObjectAdapter"/>.
/// </summary>
/// <param name="contractResolver">The <see cref="IContractResolver"/>.</param>
/// <param name="logErrorAction">The <see cref="Action"/> for logging <see cref="JsonPatchError"/>.</param>
public ObjectAdapter(
IContractResolver contractResolver,
Action<JsonPatchError> logErrorAction)
{
if (contractResolver == null)
{
throw new ArgumentNullException(nameof(contractResolver));
}
ContractResolver = contractResolver;
LogErrorAction = logErrorAction;
}
开发者ID:leloulight,项目名称:JsonPatch,代码行数:17,代码来源:ObjectAdapter.cs
示例18: IsPrimitive
public static bool IsPrimitive(IContractResolver resolver, Type type)
{
if (resolver == null)
{
//get default from json serializer (since no public access to default resolver instance)
resolver = new JsonSerializer().ContractResolver;
}
var contract = resolver.ResolveContract(type);
return contract is JsonPrimitiveContract;
}
开发者ID:paultyng,项目名称:FluentJson.NET,代码行数:12,代码来源:JsonValue.cs
示例19: CypherQuery
public CypherQuery(
string queryText,
IDictionary<string, object> queryParameters,
CypherResultMode resultMode,
CypherResultFormat resultFormat,
IContractResolver contractResolver = null)
{
this.queryText = queryText;
this.queryParameters = queryParameters;
this.resultMode = resultMode;
this.resultFormat = resultFormat;
jsonContractResolver = contractResolver ?? GraphClient.DefaultJsonContractResolver;
}
开发者ID:neildobson71,项目名称:Neo4jClient,代码行数:13,代码来源:CypherQuery.cs
示例20: SQLiteConnectionString
public SQLiteConnectionString(string databasePath, bool storeDateTimeAsTicks,
IBlobSerializer serializer = null,
IContractResolver resolver = null,
SQLiteOpenFlags? openFlags = null)
{
ConnectionString = databasePath;
StoreDateTimeAsTicks = storeDateTimeAsTicks;
DatabasePath = databasePath;
Serializer = serializer;
Resolver = resolver ?? ContractResolver.Current;
OpenFlags = openFlags ?? SQLiteOpenFlags.ReadWrite | SQLiteOpenFlags.Create;
}
开发者ID:Reza1024,项目名称:SQLite.Net-PCL,代码行数:13,代码来源:SQLiteConnectionString.cs
注:本文中的IContractResolver类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论