Exemple #1
0
        /// <summary>
        /// Initialises a new instance of the <see cref="DocumentTypeMapping{TDocument}" /> class.
        /// </summary>
        /// <param name="documentConfigBuilder">The document configuration builder.</param>
        /// <param name="documentName">The document name.</param>
        /// <param name="idMapper">The document id mapper.</param>
        /// <param name="partitionKeyMapper">The partition key mapper.</param>
        /// <param name="idPropertyName">The name of the property containing the document id.</param>
        internal DocumentTypeMapping(
            DocumentConfigBuilder documentConfigBuilder,
            string documentName,
            Func <TDocument, string> idMapper,
            Func <TDocument, string> partitionKeyMapper,
            string idPropertyName)
        {
            if (documentConfigBuilder == null)
            {
                throw new ArgumentNullException(nameof(documentConfigBuilder));
            }
            if (documentName == null)
            {
                throw new ArgumentNullException(nameof(documentName));
            }
            if (idMapper == null)
            {
                throw new ArgumentNullException(nameof(idMapper));
            }
            if (partitionKeyMapper == null)
            {
                throw new ArgumentNullException(nameof(partitionKeyMapper));
            }
            if (idPropertyName == null)
            {
                throw new ArgumentNullException(nameof(idPropertyName));
            }

            _documentConfigBuilder = documentConfigBuilder;

            DocumentName       = documentName;
            IdMapper           = idMapper;
            PartitionKeyMapper = partitionKeyMapper;
            IdPropertyName     = idPropertyName;
        }
Exemple #2
0
        /// <summary>
        /// Initialises a new instance of the <see cref="DocumentTypeMappingBuilder{TDocument}"/> class.
        /// </summary>
        /// <param name="documentConfigBuilder">The document configuration builder.</param>
        /// <param name="documentName">The document name.</param>
        internal DocumentTypeMappingBuilder(DocumentConfigBuilder documentConfigBuilder, string documentName)
        {
            if (documentConfigBuilder == null)
            {
                throw new ArgumentNullException(nameof(documentConfigBuilder));
            }
            if (documentName == null)
            {
                throw new ArgumentNullException(nameof(documentName));
            }

            _idPropertyName        = "Id";
            _documentConfigBuilder = documentConfigBuilder;
            _documentName          = documentName;
        }