Пример #1
0
        private void Init()
        {
            var xmlTypeAtt = XType.GetCustomAttribute <XmlTypeAttribute>();

            Description = xmlTypeAtt.Description;

            KeyProperty = XType.GetProperty(xmlTypeAtt.KeyPropertyName);
            if (KeyProperty == null)
            {
                throw new TestLibsException($"Couldn't find KeyProperty with name: {xmlTypeAtt.KeyPropertyName} for type: {XType}");
            }

            Location = new XmlLocation(XType);
            var propertyInfos = XType.GetProperties();

            foreach (var propertyInfo in propertyInfos)
            {
                var xmlPropertyAtt = propertyInfo.GetCustomAttribute <XmlPropertyAttribute>(true);
                if (xmlPropertyAtt != null)
                {
                    var xmlProperty = new XmlProperty(this, propertyInfo);
                    XmlProperties.Add(xmlProperty);
                }
            }
        }