-
-
Notifications
You must be signed in to change notification settings - Fork 160
Closed
Labels
Description
Split is going to allocate at least 2 additional string, and in these cases we should be able to just use Span<T> and allocate only when required.
| private static bool ContainsMediaTypeParameters(string mediaType) | |
| { | |
| var mediaTypeArr = mediaType.Split(';'); | |
| return (mediaTypeArr[0] == Constants.ContentType && mediaTypeArr.Length == 2); | |
| } |
JsonApiDotNetCore/src/JsonApiDotNetCore/Services/QueryParser.cs
Lines 97 to 104 in c2cb69f
| var propertyName = key.Split(OPEN_BRACKET, CLOSE_BRACKET)[1]; | |
| var values = value.Split(COMMA); | |
| foreach (var val in values) | |
| { | |
| (var operation, var filterValue) = ParseFilterOperation(val); | |
| queries.Add(new FilterQuery(propertyName, filterValue, operation)); | |
| } |
JsonApiDotNetCore/src/JsonApiDotNetCore/Builders/LinkBuilder.cs
Lines 23 to 37 in 83d4a1d
| private string GetNamespaceFromPath(string path, string entityName) | |
| { | |
| var nSpace = string.Empty; | |
| var segments = path.Split('/'); | |
| for (var i = 1; i < segments.Length; i++) | |
| { | |
| if (segments[i].ToLower() == entityName) | |
| break; | |
| nSpace += $"/{segments[i]}"; | |
| } | |
| return nSpace; | |
| } |
JsonApiDotNetCore/src/JsonApiDotNetCore/Internal/Query/RelatedAttrFilterQuery.cs
Lines 18 to 20 in c2cb69f
| var relationshipArray = filterQuery.Attribute.Split('.'); | |
| var relationship = GetRelationship(relationshipArray[0]); |
| var path = context.Request.Path.Value.Split('/'); |