
Hi,
I'm having trouble extracting attribute info from the Ast PropertyDeclaration. Could you please explain how I can retrieve the attribute values from a class structure like this:After the semantic parsing I'm trying to reflect on the example class and need to determine the attributes of the Products property. I'm trying to do this with code like this:
I see that AttributeArgument has a Expression attribute, but it's not clear to me how I can extract the RelationID and CollectionOfType attribute values from the example code. Could you please give some hints?
Kind regards,
Erik Pepping
I'm having trouble extracting attribute info from the Ast PropertyDeclaration. Could you please explain how I can retrieve the attribute values from a class structure like this:
using System;
using System.Collections.Generic;
using System.ComponentModel;
namespace BO_Layer_ECG
{
[Serializable]
[ClassAttribute(IsDataSourceEntity = true)]
public class Categories : INotifyPropertyChanged
{
[ClassAttribute(RelationID = "a3321f33-819e-4c67-8994-637548d22098", CollectionOfType = typeof(Products))]
public System.Collections.IList Products
{
get
{
if (_products == null) _products = new System.Collections.ArrayList();
return _products;
}
set
{
if (_products != value)
{
_products = value;
}
}
}
}
}
foreach (AttributeSection attributeSection in pProperty.AttributeSections)
{
foreach (ActiproSoftware.SyntaxEditor.Addons.DotNet.Ast.Attribute attribute in attributeSection.Attributes)
{
if (attribute.AttributeType.Name == "ClassAttribute")
{
foreach (AttributeArgument argument in attribute.Arguments)
{
//argument has argument.Expression
//How do I extract the RelationID and CollectionOfType attribute values from the example code?
}
}
}
}
Kind regards,
Erik Pepping