The current metadata API can be improved. It looks like the original design tried to unnecessarily generalize too much, thus increasing complexity and creating concepts and terminology that are not always clear. Here is a dump of several things that can be improved:
1. MetadataItem has AddAnnotation, RemoveAnnotation. The Annotations property is internal. Annotations can be retrieved using MetadataProperties but the MetadataProperty.IsAnnotation is also internal.
2. MetadataProperty doesn't need to inherit from MetadataItem. Composite MetadataProperty is probably not needed.
3. RelationshipSet, RelationshipType, RelationshipEndMember, etc do not seem to be needed because AssociationSet, AssociationType, AssociationEndMember seem to be sufficient (no relationship types other than associations are defined).
4. MetadataItem.GetGeneralFacetDescriptions is a static method that probably doesn't makes sense on every metadata item.
5. The role of EdmMember may need review. EdmProperty, NavigationProperty and ReationshipEndMember inherit from it.
6. The Documentation class cannot be instantiated; no public constructor or create method.
7. AssociationType.KeyMembers and KeyProperties seem to be the same because the first returns collection of EdmMember while second returns collection of EdmProperty
and the only EdmMember type that can be key is EdmProperty. Same with AssociationType.AssociationEndMembers and AssociationType.RelationshipEndMembers. Same with
EntitType.KeyMembers and EntityType.KeyProperties.
8. CollectionType does not have a public constructor or create method. Not sure if needed.
9. EdmFunction.ReturnParameter is probably not needed since it returns ReturnParameters.FirstOrDefault().
10. Not all properties of EdmFunctionPayload seem necessary. Maybe this class can be eliminated and better ways of constructing EdmFunction can be provided.
11. EdmModel does not have public constructors or create methods.
12. No public way of instantiating EnumMember, EnumType, Facet, FacetDescription.
13. ItemCollection and derived classes are publicly immutable, inherit from ReadOnlyMetadataCollection. May need a mutable implementation for constructing a metadata model.
14. Ability to create mutable instances may be necessary if the metadata model needs to be constructed from scratch and fed into the engine.
15. RefType does not have a public constructor or create method.
16. EdmProperty Create methods do not call SetReadOnly which is inconsistent with Create factory methods on other types.
17. SimpleType increases the depth of the type hierarchy without adding much value (other than being marker)
18. Mapping API are internal and need review and possibly re-factoring if we want to make them public.
1. MetadataItem has AddAnnotation, RemoveAnnotation. The Annotations property is internal. Annotations can be retrieved using MetadataProperties but the MetadataProperty.IsAnnotation is also internal.
2. MetadataProperty doesn't need to inherit from MetadataItem. Composite MetadataProperty is probably not needed.
3. RelationshipSet, RelationshipType, RelationshipEndMember, etc do not seem to be needed because AssociationSet, AssociationType, AssociationEndMember seem to be sufficient (no relationship types other than associations are defined).
4. MetadataItem.GetGeneralFacetDescriptions is a static method that probably doesn't makes sense on every metadata item.
5. The role of EdmMember may need review. EdmProperty, NavigationProperty and ReationshipEndMember inherit from it.
6. The Documentation class cannot be instantiated; no public constructor or create method.
7. AssociationType.KeyMembers and KeyProperties seem to be the same because the first returns collection of EdmMember while second returns collection of EdmProperty
and the only EdmMember type that can be key is EdmProperty. Same with AssociationType.AssociationEndMembers and AssociationType.RelationshipEndMembers. Same with
EntitType.KeyMembers and EntityType.KeyProperties.
8. CollectionType does not have a public constructor or create method. Not sure if needed.
9. EdmFunction.ReturnParameter is probably not needed since it returns ReturnParameters.FirstOrDefault().
10. Not all properties of EdmFunctionPayload seem necessary. Maybe this class can be eliminated and better ways of constructing EdmFunction can be provided.
11. EdmModel does not have public constructors or create methods.
12. No public way of instantiating EnumMember, EnumType, Facet, FacetDescription.
13. ItemCollection and derived classes are publicly immutable, inherit from ReadOnlyMetadataCollection. May need a mutable implementation for constructing a metadata model.
14. Ability to create mutable instances may be necessary if the metadata model needs to be constructed from scratch and fed into the engine.
15. RefType does not have a public constructor or create method.
16. EdmProperty Create methods do not call SetReadOnly which is inconsistent with Create factory methods on other types.
17. SimpleType increases the depth of the type hierarchy without adding much value (other than being marker)
18. Mapping API are internal and need review and possibly re-factoring if we want to make them public.