public static ComonentInfo FromType(Type type) { if (type.GetCustomAttribute <DontGenerateAttribute>() != null) { return(null); } ComonentInfo info = new ComonentInfo(); ComponentNameAttribute componentName = type.GetCustomAttribute <ComponentNameAttribute>(); if (componentName != null) { info.ShowName = componentName.Name; } else { info.ShowName = type.Name.Replace("Component", ""); } info.FullName = type.FullName; if (type.GetCustomAttribute <UniqueAttribute>() != null) { info.IsUnique = true; } var fields = type.GetFields(); foreach (var filed in fields) { Field newField = new Field { Name = filed.Name, TypeName = TypeNameHelper.ToCompilableString(filed.FieldType) }; if (filed.GetCustomAttribute <PrimaryEntityIndexAttribute>() != null) { newField.IndexType = EntityIndexType.PrimaryIndex; } else if (filed.GetCustomAttribute <EntityIndexAttribute>() != null) { newField.IndexType = EntityIndexType.Index; } info.Fields.Add(newField); } return(info); }