GetFullNameWithoutVersionInformation() public static method

public static GetFullNameWithoutVersionInformation ( Type entityType ) : string
entityType System.Type
return string
Exemplo 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(),
            };
            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();
        }
Exemplo n.º 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(),
            };
            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;
        }
        private JObject ConvertEntityToJson(object entity, JObject metadata)
        {
            var entityType       = entity.GetType();
            var identityProperty = documentStore.Conventions.GetIdentityProperty(entityType);

            var objectAsJson = GetObjectAsJson(entity);

            if (identityProperty != null)
            {
                objectAsJson.Remove(identityProperty.Name);
            }

            metadata["Raven-Clr-Type"] = JToken.FromObject(ReflectionUtil.GetFullNameWithoutVersionInformation(entityType));

            var entityConverted = OnEntityConverted;

            if (entityConverted != null)
            {
                entityConverted(entity, objectAsJson, metadata);
            }

            return(objectAsJson);
        }
        private JObject ConvertEntityToJson(object entity, JObject metadata)
        {
            var entityType       = entity.GetType();
            var identityProperty = documentStore.Conventions.GetIdentityProperty(entityType);

            var objectAsJson = GetObjectAsJson(entity);

            if (identityProperty != null)
            {
                objectAsJson.Remove(identityProperty.Name);
            }
#if !SILVERLIGHT
            metadata[Raven.Abstractions.Data.Constants.RavenClrType] = JToken.FromObject(ReflectionUtil.GetFullNameWithoutVersionInformation(entityType));
#else
            metadata[Raven.Abstractions.Data.Constants.RavenClrType] = JToken.FromObject(entityType.AssemblyQualifiedName);
#endif
            var entityConverted = OnEntityConverted;
            if (entityConverted != null)
            {
                entityConverted(entity, objectAsJson, metadata);
            }

            return(objectAsJson);
        }