Example #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(),
			};
			UseParallelMultiGet = false;
			DefaultQueryingConsistency = ConsistencyOptions.MonotonicRead;
			FailoverBehavior = FailoverBehavior.AllowReadsFromSecondaries;
			ShouldCacheRequest = url => true;
			FindIdentityProperty = q => q.Name == "Id";
			FindClrType = (id, doc, metadata) => metadata.Value<string>(Abstractions.Data.Constants.RavenClrType);

#if !SILVERLIGHT
			FindClrTypeName = entityType => ReflectionUtil.GetFullNameWithoutVersionInformation(entityType);
#else
			FindClrTypeName = entityType => entityType.AssemblyQualifiedName;
#endif

			FindFullDocumentKeyFromNonStringIdentifier = DefaultFindFullDocumentKeyFromNonStringIdentifier;
			FindIdentityPropertyNameFromEntityName = entityName => "Id";
			FindTypeTagName = DefaultTypeTagName;
			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 => { };
		}
Example #2
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(),
     };
     FailoverBehavior     = FailoverBehavior.AllowReadsFromSecondaries;
     ShouldCacheRequest   = url => true;
     FindIdentityProperty = q => q.Name == "Id";
     FindClrType          = (id, doc, metadata) => metadata.Value <string>(Abstractions.Data.Constants.RavenClrType);
     FindFullDocumentKeyFromNonStringIdentifier = DefaultFindFullDocumentKeyFromNonStringIdentifier;
     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 => { };
 }
Example #3
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(),
            };
            UseParallelMultiGet        = true;
            DefaultQueryingConsistency = ConsistencyOptions.MonotonicRead;
            FailoverBehavior           = FailoverBehavior.AllowReadsFromSecondaries;
            ShouldCacheRequest         = url => true;
            FindIdentityProperty       = q => q.Name == "Id";
            FindClrType = (id, doc, metadata) => metadata.Value <string>(Abstractions.Data.Constants.RavenClrType);

#if !SILVERLIGHT
            FindClrTypeName = entityType => ReflectionUtil.GetFullNameWithoutVersionInformation(entityType);
#else
            FindClrTypeName = entityType => entityType.AssemblyQualifiedName;
#endif
            TransformTypeTagNameToDocumentKeyPrefix    = DefaultTransformTypeTagNameToDocumentKeyPrefix;
            FindFullDocumentKeyFromNonStringIdentifier = DefaultFindFullDocumentKeyFromNonStringIdentifier;
            FindIdentityPropertyNameFromEntityName     = entityName => "Id";
            FindTypeTagName                 = DefaultTypeTagName;
            FindPropertyNameForIndex        = (indexedType, indexedName, path, prop) => (path + prop).Replace(",", "_").Replace(".", "_");
            FindPropertyNameForDynamicIndex = (indexedType, indexedName, path, prop) => path + prop;
            IdentityPartsSeparator          = "/";
            JsonContractResolver            = new DefaultRavenContractResolver(shareCache: true)
            {
                DefaultMembersSearchFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance
            };
            MaxNumberOfRequestsPerSession         = 30;
            CustomizeJsonSerializer               = serializer => { };
            FindIdValuePartForValueTypeConversion = (entity, id) => id.Split(new[] { IdentityPartsSeparator }, StringSplitOptions.RemoveEmptyEntries).Last();
        }
Example #4
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(),
			};
			FailoverBehavior = FailoverBehavior.AllowReadsFromSecondaries;
			ShouldCacheRequest = url => true;
			FindIdentityProperty = q => q.Name == "Id";
			FindClrType = (id, doc, metadata) => metadata.Value<string>(Abstractions.Data.Constants.RavenClrType);
			FindFullDocumentKeyFromNonStringIdentifier = DefaultFindFullDocumentKeyFromNonStringIdentifier;
			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 => { };
		}
Example #5
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(),
            };
            PreserveDocumentPropertiesNotFoundOnModel = true;
            PrettifyGeneratedLinqExpressions          = true;
            DisableProfiling     = true;
            UseParallelMultiGet  = true;
            FailoverBehavior     = FailoverBehavior.AllowReadsFromSecondaries;
            ShouldCacheRequest   = url => true;
            FindIdentityProperty = q => q.Name == "Id";
            FindClrType          = (id, doc, metadata) => metadata.Value <string>(Constants.Headers.RavenClrType);
            FindClrTypeNew       = (id, doc) =>
            {
                BlittableJsonReaderObject metadata;
                string clrType;
                if (doc.TryGet(Constants.Metadata.Key, out metadata) && metadata.TryGet(Constants.Headers.RavenClrType, out clrType))
                {
                    return(clrType);
                }
                return(null);
            };

            FindClrTypeName = ReflectionUtil.GetFullNameWithoutVersionInformation;
            TransformTypeTagNameToDocumentKeyPrefix    = DefaultTransformTypeTagNameToDocumentKeyPrefix;
            FindFullDocumentKeyFromNonStringIdentifier = DefaultFindFullDocumentKeyFromNonStringIdentifier;
            FindIdentityPropertyNameFromEntityName     = entityName => "Id";
            FindTypeTagName                            = DefaultTypeTagName;
            FindPropertyNameForIndex                   = (indexedType, indexedName, path, prop) => (path + prop).Replace(",", "_").Replace(".", "_");
            FindPropertyNameForDynamicIndex            = (indexedType, indexedName, path, prop) => path + prop;
            IdentityPartsSeparator                     = "/";
            JsonContractResolver                       = new DefaultRavenContractResolver();
            MaxNumberOfRequestsPerSession              = 30;
            MaxLengthOfQueryUsingGetUrl                = 1024 + 512;
            ApplyReduceFunction                        = DefaultApplyReduceFunction;
            ReplicationInformerFactory                 = (url, jsonRequestFactory) => new ReplicationInformer(this, jsonRequestFactory);
            CustomizeJsonSerializer                    = serializer => { }; // todo: remove this or merge with SerializeEntityToJsonStream
            FindIdValuePartForValueTypeConversion      = (entity, id) => id.Split(new[] { IdentityPartsSeparator }, StringSplitOptions.RemoveEmptyEntries).Last();
            ShouldAggressiveCacheTrackChanges          = true;
            ShouldSaveChangesForceAggressiveCacheCheck = true;
            IndexAndTransformerReplicationMode         = IndexAndTransformerReplicationMode.Indexes | IndexAndTransformerReplicationMode.Transformers;
            AcceptGzipContent                          = true;
            RequestTimeThresholdInMilliseconds         = 100;

            SerializeEntityToJsonStream = (entity, streamWriter) =>
            {
                var jsonSerializer = CreateSerializer();
                jsonSerializer.Serialize(streamWriter, entity);
                streamWriter.Flush();
            };

            DeserializeEntityFromBlittable = new JsonNetBlittableEntitySerializer(this).EntityFromJsonStream;
        }
		public DocumentConvention()
		{
			FindIdentityProperty = q => q.Name == "Id";
			FindTypeTagName = t => DefaultTypeTagName(t);
			IdentityPartsSeparator = "/";
			JsonContractResolver = new DefaultRavenContractResolver(shareCache: true)
			{
				DefaultMembersSearchFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance
			};
		    MaxNumberOfRequestsPerSession = 30;
			CustomizeJsonSerializer = serializer => { };
		}
Example #7
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(),
            };
            PreserveDocumentPropertiesNotFoundOnModel = true;
#if !DNXCORE50
            PrettifyGeneratedLinqExpressions = true;
#endif
            DisableProfiling = true;
            EnlistInDistributedTransactions = true;
            UseParallelMultiGet             = true;
            DefaultQueryingConsistency      = ConsistencyOptions.None;
            FailoverBehavior     = FailoverBehavior.AllowReadsFromSecondaries;
            ShouldCacheRequest   = url => true;
            FindIdentityProperty = q => q.Name == "Id";
            FindClrType          = (id, doc, metadata) => metadata.Value <string>(Abstractions.Data.Constants.RavenClrType);

            FindClrTypeName = ReflectionUtil.GetFullNameWithoutVersionInformation;
            TransformTypeTagNameToDocumentKeyPrefix    = DefaultTransformTypeTagNameToDocumentKeyPrefix;
            FindFullDocumentKeyFromNonStringIdentifier = DefaultFindFullDocumentKeyFromNonStringIdentifier;
            FindIdentityPropertyNameFromEntityName     = entityName => "Id";
            FindTypeTagName                 = DefaultTypeTagName;
            FindPropertyNameForIndex        = (indexedType, indexedName, path, prop) => (path + prop).Replace(",", "_").Replace(".", "_");
            FindPropertyNameForDynamicIndex = (indexedType, indexedName, path, prop) => path + prop;
            IdentityPartsSeparator          = "/";
            JsonContractResolver            = new DefaultRavenContractResolver(shareCache: true)
            {
                DefaultMembersSearchFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance
            };
            MaxNumberOfRequestsPerSession              = 30;
            MaxLengthOfQueryUsingGetUrl                = 1024 + 512;
            ApplyReduceFunction                        = DefaultApplyReduceFunction;
            ReplicationInformerFactory                 = (url, jsonRequestFactory, requestTimeMetricGetter) => new ReplicationInformer(this, jsonRequestFactory, requestTimeMetricGetter);
            CustomizeJsonSerializer                    = serializer => { };
            FindIdValuePartForValueTypeConversion      = (entity, id) => id.Split(new[] { IdentityPartsSeparator }, StringSplitOptions.RemoveEmptyEntries).Last();
            ShouldAggressiveCacheTrackChanges          = true;
            ShouldSaveChangesForceAggressiveCacheCheck = true;
            IndexAndTransformerReplicationMode         = IndexAndTransformerReplicationMode.Indexes | IndexAndTransformerReplicationMode.Transformers;
            AcceptGzipContent = true;
            RequestTimeSlaThresholdInMilliseconds       = 100;
            TimeToWaitBetweenReplicationTopologyUpdates = TimeSpan.FromMinutes(5);
        }
Example #8
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(),
            };
            MaxFailoverCheckPeriod          = TimeSpan.FromMinutes(5);
            DisableProfiling                = true;
            EnlistInDistributedTransactions = true;
            UseParallelMultiGet             = true;
            DefaultQueryingConsistency      = ConsistencyOptions.None;
            FailoverBehavior                = FailoverBehavior.AllowReadsFromSecondaries;
            ShouldCacheRequest              = url => true;
            FindIdentityProperty            = q => q.Name == "Id";
            FindClrType = (id, doc, metadata) => metadata.Value <string>(Abstractions.Data.Constants.RavenClrType);

#if !SILVERLIGHT
            FindClrTypeName = entityType => ReflectionUtil.GetFullNameWithoutVersionInformation(entityType);
#else
            FindClrTypeName = entityType => entityType.AssemblyQualifiedName;
#endif
            TransformTypeTagNameToDocumentKeyPrefix    = DefaultTransformTypeTagNameToDocumentKeyPrefix;
            FindFullDocumentKeyFromNonStringIdentifier = DefaultFindFullDocumentKeyFromNonStringIdentifier;
            FindIdentityPropertyNameFromEntityName     = entityName => "Id";
            FindTypeTagName                 = DefaultTypeTagName;
            FindPropertyNameForIndex        = (indexedType, indexedName, path, prop) => (path + prop).Replace(",", "_").Replace(".", "_");
            FindPropertyNameForDynamicIndex = (indexedType, indexedName, path, prop) => path + prop;
            IdentityPartsSeparator          = "/";
            JsonContractResolver            = new DefaultRavenContractResolver(shareCache: true)
            {
#if !NETFX_CORE
                DefaultMembersSearchFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance
#endif
            };
            MaxNumberOfRequestsPerSession              = 30;
            ApplyReduceFunction                        = DefaultApplyReduceFunction;
            ReplicationInformerFactory                 = url => new ReplicationInformer(this);
            CustomizeJsonSerializer                    = serializer => { };
            FindIdValuePartForValueTypeConversion      = (entity, id) => id.Split(new[] { IdentityPartsSeparator }, StringSplitOptions.RemoveEmptyEntries).Last();
            ShouldAggressiveCacheTrackChanges          = true;
            ShouldSaveChangesForceAggressiveCacheCheck = true;
        }
Example #9
0
		/// <summary>
		/// Initializes a new instance of the <see cref="DocumentConvention"/> class.
		/// </summary>
		public DocumentConvention()
		{
			IdentityTypeConvertors = new List<ITypeConverter>
			{
				new Converters.GuidConverter(),
				new Converters.Int32Converter(),
				new Converters.Int64Converter(),
			};
			ShouldCacheRequest = url => true;
			FindIdentityProperty = q => q.Name == "Id";
			FindTypeTagName = t => DefaultTypeTagName(t);
			IdentityPartsSeparator = "/";
			JsonContractResolver = new DefaultRavenContractResolver(shareCache: true)
			{
				DefaultMembersSearchFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance
			};
			MaxNumberOfRequestsPerSession = 30;
			CustomizeJsonSerializer = serializer => { };
		}
Example #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DocumentConvention"/> class.
 /// </summary>
 public DocumentConvention()
 {
     IdentityTypeConvertors = new List <ITypeConverter>
     {
         new Converters.GuidConverter(),
         new Converters.Int32Converter(),
         new Converters.Int64Converter(),
     };
     FailoverBehavior       = FailoverBehavior.AllowReadsFromSecondaries;
     ShouldCacheRequest     = url => true;
     FindIdentityProperty   = q => q.Name == "Id";
     FindTypeTagName        = t => DefaultTypeTagName(t);
     IdentityPartsSeparator = "/";
     JsonContractResolver   = new DefaultRavenContractResolver(shareCache: true)
     {
         DefaultMembersSearchFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance
     };
     MaxNumberOfRequestsPerSession = 30;
     CustomizeJsonSerializer       = serializer => { };
 }
Example #11
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(),
			};
			EnlistInDistributedTransactions = true;
			UseParallelMultiGet = true;
			DefaultQueryingConsistency = ConsistencyOptions.MonotonicRead;
			FailoverBehavior = FailoverBehavior.AllowReadsFromSecondaries;
			ShouldCacheRequest = url => true;
			FindIdentityProperty = q => q.Name == "Id";
			FindClrType = (id, doc, metadata) => metadata.Value<string>(Abstractions.Data.Constants.RavenClrType);

#if !SILVERLIGHT
			FindClrTypeName = entityType => ReflectionUtil.GetFullNameWithoutVersionInformation(entityType);
#else
			FindClrTypeName = entityType => entityType.AssemblyQualifiedName;
#endif
			TransformTypeTagNameToDocumentKeyPrefix = DefaultTransformTypeTagNameToDocumentKeyPrefix;
			FindFullDocumentKeyFromNonStringIdentifier = DefaultFindFullDocumentKeyFromNonStringIdentifier;
			FindIdentityPropertyNameFromEntityName = entityName => "Id";
			FindTypeTagName = DefaultTypeTagName;
			FindPropertyNameForIndex = (indexedType, indexedName, path, prop) => (path + prop).Replace(",", "_").Replace(".", "_");
			FindPropertyNameForDynamicIndex = (indexedType, indexedName, path, prop) => path + prop;
			IdentityPartsSeparator = "/";
			JsonContractResolver = new DefaultRavenContractResolver(shareCache: true)
			{
				DefaultMembersSearchFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance
			};
			MaxNumberOfRequestsPerSession = 30;
			ApplyReduceFunction = DefaultApplyReduceFunction;
			CustomizeJsonSerializer = serializer => { };
			FindIdValuePartForValueTypeConversion = (entity, id) => id.Split(new[] {IdentityPartsSeparator}, StringSplitOptions.RemoveEmptyEntries) .Last();
		}