コード例 #1
0
        /// <summary>
        /// Extracts the data from the ParameterAttribute and creates the member data as necessary.
        /// </summary>
        /// <param name="parameterName">
        /// The name of the parameter.
        /// </param>
        /// <param name="parameter">
        /// The instance of the ParameterAttribute to extract the data from.
        /// </param>
        /// <exception cref="MetadataException">
        /// If a parameter set name has already been declared on this parameter.
        /// </exception>
        private void ProcessParameterAttribute(
            string parameterName,
            ParameterAttribute parameter)
        {
            // If the parameter set name already exists on this parameter and the set name is the default parameter
            // set name, it is an error.

            if (ParameterSetData.ContainsKey(parameter.ParameterSetName))
            {
                MetadataException e =
                    new MetadataException(
                        "ParameterDeclaredInParameterSetMultipleTimes",
                        null,
                        DiscoveryExceptions.ParameterDeclaredInParameterSetMultipleTimes,
                        parameterName,
                        parameter.ParameterSetName);

                throw e;
            }

            if (parameter.ValueFromPipeline || parameter.ValueFromPipelineByPropertyName)
            {
                IsPipelineParameterInSomeParameterSet = true;
            }

            if (parameter.Mandatory)
            {
                IsMandatoryInSomeParameterSet = true;
            }

            // Construct an instance of the parameter set specific data
            ParameterSetSpecificMetadata parameterSetSpecificData = new ParameterSetSpecificMetadata(parameter);

            ParameterSetData.Add(parameter.ParameterSetName, parameterSetSpecificData);
        }
コード例 #2
0
ファイル: SyncExpt.cs プロジェクト: weedkiller/CrmSync
        internal static MetadataException WritingTableAnchorError(string tableName, string anchorType, string source, string helpLink, SyncErrorNumber code)
        {
            MetadataException metadataException = new MetadataException(SyncResource.FormatString("Internal_SetTableAnchorFailed", (object)anchorType, (object)tableName));

            metadataException.SyncSource  = source;
            metadataException.SyncStage   = SyncStage.WritingMetadata;
            metadataException.ErrorNumber = code;
            metadataException.HelpLink    = helpLink;
            metadataException.TableName   = tableName;
            SyncTracer.Warning("{0}", new object[1]
            {
                (object)metadataException
            });
            return(metadataException);
        }
コード例 #3
0
ファイル: SyncExpt.cs プロジェクト: weedkiller/CrmSync
        internal static MetadataException SubscribingTableError(string tableName, string source, string helpLink)
        {
            MetadataException metadataException = new MetadataException(SyncResource.FormatString("Internal_ErrorInSubscribingTable", new object[1]
            {
                (object)tableName
            }));

            metadataException.SyncSource  = source;
            metadataException.SyncStage   = SyncStage.WritingMetadata;
            metadataException.ErrorNumber = SyncErrorNumber.AddingTableMetadataFailed;
            metadataException.HelpLink    = helpLink;
            metadataException.TableName   = tableName;
            SyncTracer.Warning("{0}", new object[1]
            {
                (object)metadataException
            });
            return(metadataException);
        }
コード例 #4
0
ファイル: SyncExpt.cs プロジェクト: weedkiller/CrmSync
        internal static MetadataException CreateSystemTablesError(string tableName, string source, string helpLink, Exception inner)
        {
            MetadataException metadataException = new MetadataException(SyncResource.FormatString("Internal_ErrorCreatingSystemTables", new object[1]
            {
                (object)tableName
            }), inner);

            metadataException.SyncSource  = source;
            metadataException.SyncStage   = SyncStage.CreatingMetadata;
            metadataException.ErrorNumber = SyncErrorNumber.StoreException;
            metadataException.HelpLink    = helpLink;
            metadataException.TableName   = tableName;
            SyncTracer.Warning("{0}", new object[1]
            {
                (object)metadataException
            });
            return(metadataException);
        }
コード例 #5
0
        /// <summary>
        /// Extracts the data from the ParameterAttribute and creates the member data as necessary.
        /// </summary>
        /// 
        /// <param name="parameterName">
        /// The name of the parameter.
        /// </param>
        /// 
        /// <param name="parameter">
        /// The instance of the ParameterAttribute to extract the data from.
        /// </param>
        /// 
        /// <exception cref="MetadataException">
        /// If a parameter set name has already been declared on this parameter.
        /// </exception>
        /// 
        private void ProcessParameterAttribute(
            string parameterName,
            ParameterAttribute parameter)
        {
            // If the parameter set name already exists on this parameter and the set name is the default parameter
            // set name, it is an error.

            if (ParameterSetData.ContainsKey(parameter.ParameterSetName))
            {
                MetadataException e =
                    new MetadataException(
                        "ParameterDeclaredInParameterSetMultipleTimes",
                        null,
                        DiscoveryExceptions.ParameterDeclaredInParameterSetMultipleTimes,
                        parameterName,
                        parameter.ParameterSetName);

                throw e;
            }

            if (parameter.ValueFromPipeline || parameter.ValueFromPipelineByPropertyName)
            {
                IsPipelineParameterInSomeParameterSet = true;
            }
            if (parameter.Mandatory)
            {
                IsMandatoryInSomeParameterSet = true;
            }

            // Construct an instance of the parameter set specific data
            ParameterSetSpecificMetadata parameterSetSpecificData = new ParameterSetSpecificMetadata(parameter);
            ParameterSetData.Add(parameter.ParameterSetName, parameterSetSpecificData);
        }
コード例 #6
0
        internal static MetadataException Metadata(string message)
        {
            var e = new MetadataException(message);

            return(e);
        }