Skip to content

Improve APIs for IEdmModel look ups and traversal #3147

@habbes

Description

@habbes

The model provides a lot of APIs for traversing and querying elements in the model. However, a lot of this APIs are insufficient or limited, leading to expensive lookup operations.

Here are example of things that are difficult to do and lead to inefficient traversals

  • Finding all properties in a model, or finding properties that meet a certain criteria. Currently, to find properties, you need to go through the collection of entity and complex types, e.g. model.SchemaElements.OfType<IEdmStructuredType()>().SelectMany(t => t.DeclaredProperties)
  • Finding a type or property using a span (to avoid substring allocations) related: 2801
  • Finding a type or property by name, using case-insensitive or custom comparer. In the past, we have resorted to reading all elements that need to be looked up and caching them in a separate dictionary with case-insensitive comparer, see: Create cache to speed up case-insensitive look up of schema elements #2610
  • etc.

Assemblies affected

Microsoft.OData.Edm 8.x

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions