The default json contract will serialize all properties and all public fields
Inheritance: Newtonsoft.Json.Serialization.DefaultContractResolver
Ejemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DocumentConvention"/> class.
 /// </summary>
 public DocumentConvention()
 {
     IdentityTypeConvertors = new List <ITypeConverter>
     {
         new GuidConverter(),
         new Int32Converter(),
         new Int64Converter(),
     };
     ShouldCacheRequest   = url => true;
     FindIdentityProperty = q => q.Name == "Id";
     FindClrType          = (id, doc, metadata) => metadata.Value <string>(Constants.RavenClrType);
     FindFullDocumentKeyFromValueTypeIdentifier = DefaultFindFullDocumentKeyFromValueTypeIdentifier;
     FindIdentityPropertyNameFromEntityName     = entityName => "Id";
     FindTypeTagName                 = t => DefaultTypeTagName(t);
     FindPropertyNameForIndex        = (indexedType, indexedName, path, prop) => prop;
     FindPropertyNameForDynamicIndex = (indexedType, indexedName, path, prop) => path + prop;
     IdentityPartsSeparator          = "/";
     JsonContractResolver            = new DefaultRavenContractResolver(shareCache: true)
     {
         DefaultMembersSearchFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance
     };
     MaxNumberOfRequestsPerSession = 30;
     CustomizeJsonSerializer       = serializer => { };
 }
		/// <summary>
		/// Initializes a new instance of the <see cref="DocumentConvention"/> class.
		/// </summary>
		public DocumentConvention()
		{
			IdentityTypeConvertors = new List<ITypeConverter>
			{
				new GuidConverter(),
				new Int32Converter(),
				new Int64Converter(),
			};
			ShouldCacheRequest = url => true;
			FindIdentityProperty = q => q.Name == "Id";
			FindClrType = (id, doc, metadata) => metadata.Value<string>(Constants.RavenClrType);
			FindFullDocumentKeyFromValueTypeIdentifier = DefaultFindFullDocumentKeyFromValueTypeIdentifier;
			FindIdentityPropertyNameFromEntityName = entityName => "Id";
			FindTypeTagName = t => DefaultTypeTagName(t);
			FindPropertyNameForIndex = (indexedType, indexedName, path, prop) => prop;
			FindPropertyNameForDynamicIndex = (indexedType, indexedName, path, prop) => path + prop;
			IdentityPartsSeparator = "/";
			JsonContractResolver = new DefaultRavenContractResolver(shareCache: true)
			{
				DefaultMembersSearchFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance
			};
			MaxNumberOfRequestsPerSession = 30;
			CustomizeJsonSerializer = serializer => { };
		}