///<summary> /// Find the full document name assuming that we are using the standard conventions /// for generating a document key ///</summary> ///<returns></returns> public string DefaultFindFullDocumentKeyFromNonStringIdentifier(object id, Type type, bool allowNull) { var valueTypeId = id as ValueType; if (valueTypeId != null) { var outputId = TryGetDocumentIdFromRegisteredIdLoadConventions(valueTypeId, type); if (outputId != null) { return(outputId); } } var converter = IdentityTypeConvertors.FirstOrDefault(x => x.CanConvertFrom(id.GetType())); var tag = GetTypeTagName(type); if (tag != null) { tag = TransformTypeTagNameToDocumentKeyPrefix(tag); tag += IdentityPartsSeparator; } if (converter != null) { return(converter.ConvertFrom(tag, id, allowNull)); } return(tag + id); }
///<summary> /// Find the full document name assuming that we are using the standard conventions /// for generating a document key ///</summary> ///<returns></returns> public string DefaultFindFullDocumentKeyFromValueTypeIdentifier(ValueType id, Type type) { string idPart; var converter = IdentityTypeConvertors.FirstOrDefault(x => x.CanConvertFrom(id.GetType())); if (converter != null) { idPart = converter.ConvertFrom(id); } else { idPart = id.ToString(); } return(GetTypeTagName(type) + IdentityPartsSeparator + idPart); }
///<summary> /// Find the full document name assuming that we are using the standard conventions /// for generating a document key ///</summary> ///<returns></returns> public string DefaultFindFullDocumentKeyFromNonStringIdentifier(object id, Type type, bool allowNull) { var converter = IdentityTypeConvertors.FirstOrDefault(x => x.CanConvertFrom(id.GetType())); var tag = GetTypeTagName(type); if (tag != null) { tag += IdentityPartsSeparator; tag = tag.ToLowerInvariant(); } if (converter != null) { return(converter.ConvertFrom(tag, id, allowNull)); } return(tag + id); }