Exemple #1
0
        /// <summary>
        /// Sets the <see cref="SpecType"/>
        /// </summary>
        /// <param name="specType">
        /// The <see cref="SpecType"/> to set.
        /// </param>
        protected override void SetSpecType(SpecType specType)
        {
            if (specType.GetType() != typeof(SpecObjectType))
            {
                throw new ArgumentException("specType must of type SpecObjectType");
            }

            this.Type = (SpecObjectType)specType;
        }
Exemple #2
0
 /// <summary>
 /// Reads the <see cref="SpecType"/> which is specific to the <see cref="SpecObject"/> class.
 /// </summary>
 /// <param name="reader">
 /// an instance of <see cref="XmlReader"/>
 /// </param>
 protected override void ReadSpecType(XmlReader reader)
 {
     if (reader.ReadToDescendant("SPEC-OBJECT-TYPE-REF"))
     {
         var reference = reader.ReadElementContentAsString();
         var specType  = this.ReqIfContent.SpecTypes.SingleOrDefault(x => x.Identifier == reference);
         this.Type = (SpecObjectType)specType;
     }
 }
Exemple #3
0
        /// <summary>
        /// Reads the <see cref="SpecType"/> which is specific to the <see cref="SpecObject"/> class.
        /// </summary>
        /// <param name="reader">
        /// an instance of <see cref="XmlReader"/>
        /// </param>
        protected override void ReadSpecType(XmlReader reader)
        {
            if (reader.ReadToDescendant("SPEC-OBJECT-TYPE-REF"))
            {
                var reference = reader.ReadElementContentAsString();
                var specType  = this.ReqIFContent.SpecTypes.SingleOrDefault(x => x.Identifier == reference);
                this.Type = (SpecObjectType)specType;

                if (specType == null)
                {
                    this.logger.LogTrace("The SpecObjectType:{reference} could not be found and has been set to null on SpecObject:{Identifier}", reference, Identifier);
                }
            }
        }
Exemple #4
0
        /// <summary>
        /// Asynchronously reads the <see cref="SpecType"/> which is specific to the <see cref="SpecObject"/> class.
        /// </summary>
        /// <param name="reader">
        /// an instance of <see cref="XmlReader"/>
        /// </param>
        /// <param name="token">
        /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        protected override async Task ReadSpecTypeAsync(XmlReader reader, CancellationToken token)
        {
            if (token.IsCancellationRequested)
            {
                token.ThrowIfCancellationRequested();
            }

            if (reader.ReadToDescendant("SPEC-OBJECT-TYPE-REF"))
            {
                var reference = await reader.ReadElementContentAsStringAsync();

                var specType = this.ReqIFContent.SpecTypes.SingleOrDefault(x => x.Identifier == reference);
                this.Type = (SpecObjectType)specType;

                if (specType == null)
                {
                    this.logger.LogTrace("The SpecObjectType:{reference} could not be found and has been set to null on SpecObject:{Identifier}", reference, Identifier);
                }
            }
        }