protected override bool TryMatch(IMetadataAttribute attribute, out bool result)
 {
     return(result =
                attribute.FixedArguments.FirstOrDefault() is ConstantAttributeValue constant &&
                constant.Value.TypeCode == ConstantTypeCode.String &&
                constant.Value.GetValueAsString() == "Types with embedded references are not supported in this version of your compiler.");
 }
예제 #2
0
        public IDictionary <string, object> GetAttributeValues(IMetadataAttribute attribute)
        {
            var output = new Dictionary <string, object>();

            foreach (var property in attribute.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance))
            {
                output[property.Name] = property.GetValue(attribute);
            }

            return(output);
        }
 protected override bool TryMatch(IMetadataAttribute attribute, out string result)
 {
     if (attribute.FixedArguments.FirstOrDefault() is ConstantAttributeValue constant &&
         constant.Value.TypeCode == ConstantTypeCode.String)
     {
         result = constant.Value.GetValueAsString();
         return(true);
     }
     result = default;
     return(false);
 }
		public ReportedAttributeObjectBaseCore(
				IMetadataAttribute correspondingMA,
				IReportedAttribute builtFrom,
				IIdentifiableRetrievalManager retrievalManager) : base(builtFrom) {
                    this.reportedAttributes = new List<IReportedAttributeBase>();
			this.builtFrom = builtFrom;
			concept = retrievalManager.GetIdentifiableObject<IConceptObject>(
					correspondingMA.ConceptRef, typeof(IConceptObject));
			if (correspondingMA.HasCodedRepresentation()) {
                this.codelist = retrievalManager.GetIdentifiableObject<ICodelistObject>(
						correspondingMA.Representation.RepresentationRef,
						typeof(ICodelistObject));
			}
			if (builtFrom.ReportedAttributes != null) {
				/* foreach */
				foreach (IReportedAttribute reportedAttribute  in  builtFrom
						.ReportedAttributes) {
					IMetadataAttribute metadataAttribute = GetMetadataAttributeForRepotedAttribtue(
							reportedAttribute, correspondingMA.MetadataAttributes);
					reportedAttributes.Add(new ReportedAttributeObjectBaseCore(metadataAttribute, reportedAttribute, retrievalManager));
				}
			}
		}
 protected override bool TryMatch(IMetadataAttribute attribute, out bool result) => result = true;
 protected abstract bool TryMatch(string @namespace, string name, IMetadataAttribute attribute);