Пример #1
0
        /// <summary>
        /// Gets contract name for the provided <see cref="IImportConvention"/>.
        /// </summary>
        /// <param name="importConvention">The <see cref="IImportConvention"/> that the contract name should be retreived for.</param>
        /// <param name="member">The <see cref="MemberInfo"/> that is being imported.</param>
        /// <returns>A <see cref="string"/> containing the contract name for the import.</returns>
        /// <exception cref="ArgumentNullException">The value of the <paramref name="member"/> or <paramref name="importConvention"/> parameter was <see langword="null"/>.</exception>
        public virtual string GetImportContractName(IImportConvention importConvention, MemberInfo member)
        {
            if (importConvention == null)
            {
                throw new ArgumentNullException("importConvention", "The import convention cannot be null.");
            }

            if (member == null)
            {
                throw new ArgumentNullException("member", "The member cannot be null.");
            }

            return(ContractServices.GetImportContractName(
                       (importConvention.ContractName == null) ? null : importConvention.ContractName.Invoke(member),
                       (importConvention.ContractType == null) ? null : importConvention.ContractType.Invoke(member),
                       member));
        }