Skip to content

Commit

Permalink
Perf Fix CreateEtags (#1128)
Browse files Browse the repository at this point in the history
* Perf Fix CreateEtags

* update based on review comments
  • Loading branch information
ElizabethOkerio committed Jan 10, 2024
1 parent cd05ff8 commit c4de3fa
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -773,20 +773,22 @@ public virtual string CreateETag(ResourceContext resourceContext)
IEnumerable<IEdmStructuralProperty> concurrencyProperties;
if (model != null && navigationSource != null)
{
concurrencyProperties = model.GetConcurrencyProperties(navigationSource).OrderBy(c => c.Name);
concurrencyProperties = model.GetConcurrencyProperties(navigationSource);
}
else
{
concurrencyProperties = Enumerable.Empty<IEdmStructuralProperty>();
}

IDictionary<string, object> properties = new Dictionary<string, object>();
IDictionary<string, object> properties = null;
foreach (IEdmStructuralProperty etagProperty in concurrencyProperties)
{
properties ??= new SortedDictionary<string, object>();

properties.Add(etagProperty.Name, resourceContext.GetPropertyValue(etagProperty.Name));
}

if (properties.Count != 0)
if (properties != null)
{
return resourceContext.Request.CreateETag(properties, resourceContext.TimeZone);
}
Expand Down

0 comments on commit c4de3fa

Please sign in to comment.