public static string SelectAttributes()

in apps/samplecode/education/rosterapi/EducationAccelerator.WebApi/EducationAccelerator.WebApi/Models/BaseModel.cs [111:128]


        public static string SelectAttributes<T>(StringValues fields)
        {
            Type modelType = typeof(T);
            var attributeMap = (Dictionary<string, string>)modelType.GetField("Fields")?.GetValue(null);
            var attributes = fields.Count > 0 ? fields.ToArray() : attributeMap.Keys.ToArray();

            var fetch = new StringBuilder();

            foreach (var attribute in attributes)
            {
                if (attributeMap.ContainsKey(attribute))
                {
                    fetch.Append($"<attribute name='{attributeMap[attribute]}' />");
                }
            }

            return fetch.ToString();
        }