-
-
Notifications
You must be signed in to change notification settings - Fork 158
Query tweaks #1257
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Query tweaks #1257
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov Report
@@ Coverage Diff @@
## master #1257 +/- ##
==========================================
- Coverage 92.69% 92.69% -0.01%
==========================================
Files 243 243
Lines 7814 7813 -1
==========================================
- Hits 7243 7242 -1
Misses 571 571
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
78af822
to
b7a3890
Compare
… of a string value. This effectively moves the type resolving/conversion logic from the EF query production phase to the filter parsing phase. By providing a richer QueryLayer model, it becomes easier to implement non-relational and non-EF Core-based repositories. And it enables to produce better errors earlier. Note we still need to wrap nullable values (see WhereClauseBuilder.ResolveCommonType), due to https://bradwilson.typepad.com/blog/2008/07/creating-nullab.html.
b25b6bb
to
9cf0c70
Compare
fe37d6a
to
d8d2248
Compare
…ibute, so this can never fail)
…any specific record
259ba25
to
cb4c793
Compare
| Method | Mean | Error | StdDev | Ratio | Gen0 | Allocated | Alloc Ratio | |---------------- |---------:|----------:|----------:|------:|-------:|----------:|------------:| | TrackChanges | 3.741 us | 0.0122 us | 0.0114 us | 1.00 | 0.0229 | 6.41 KB | 1.00 | | NewTrackChanges | 1.359 us | 0.0070 us | 0.0066 us | 0.36 | 0.0095 | 2.62 KB | 0.41 | using BenchmarkDotNet.Attributes; using JsonApiDotNetCore.Configuration; using JsonApiDotNetCore.Middleware; using JsonApiDotNetCore.Resources; using JsonApiDotNetCore.Resources.Annotations; using Microsoft.Extensions.Logging.Abstractions; namespace Benchmarks.ChangeTracking; // ReSharper disable once ClassCanBeSealed.Global [MarkdownExporter] [MemoryDiagnoser] public class ChangeTrackerBenchmarks { private readonly JsonApiRequest _request; private readonly TargetedFields _targetedFields; public ChangeTrackerBenchmarks() { IJsonApiOptions options = new JsonApiOptions(); IResourceGraph resourceGraph = new ResourceGraphBuilder(options, NullLoggerFactory.Instance).Add<ExampleResource, long>().Build(); ResourceType resourceType = resourceGraph.GetResourceType<ExampleResource>(); _request = new JsonApiRequest { PrimaryResourceType = resourceType, IsCollection = true }; _targetedFields = new TargetedFields(); foreach (AttrAttribute attribute in resourceType.Attributes) { _targetedFields.Attributes.Add(attribute); } } [Benchmark(Baseline = true)] public void TrackChanges() { var changeTracker = new ResourceChangeTracker<ExampleResource>(_request, _targetedFields); var resource = new ExampleResource { Id = 1, Attr1 = "some", Attr2 = "more", Attr3 = "other", Attr4 = false, Attr5 = 123, Attr6 = default, Attr7 = default, Attr8 = default, Attr9 = DayOfWeek.Sunday }; changeTracker.SetInitiallyStoredAttributeValues(resource); resource = new ExampleResource { Id = 1, Attr1 = "new", Attr2 = "change", Attr3 = "this", Attr4 = true, Attr5 = 456, Attr6 = default, Attr7 = default, Attr8 = default, Attr9 = DayOfWeek.Saturday }; changeTracker.SetFinallyStoredAttributeValues(resource); changeTracker.HasImplicitChanges(); } [Benchmark] public void NewTrackChanges() { var changeTracker = new NewResourceChangeTracker<ExampleResource>(_request, _targetedFields); var resource = new ExampleResource { Id = 1, Attr1 = "some", Attr2 = "more", Attr3 = "other", Attr4 = false, Attr5 = 123, Attr6 = default, Attr7 = default, Attr8 = default, Attr9 = DayOfWeek.Sunday }; changeTracker.SetInitiallyStoredAttributeValues(resource); resource = new ExampleResource { Id = 1, Attr1 = "new", Attr2 = "change", Attr3 = "this", Attr4 = true, Attr5 = 456, Attr6 = default, Attr7 = default, Attr8 = default, Attr9 = DayOfWeek.Saturday }; changeTracker.SetFinallyStoredAttributeValues(resource); changeTracker.HasImplicitChanges(); } private sealed class ExampleResource : Identifiable<long> { [Attr] public string? Attr1 { get; set; } [Attr] public string? Attr2 { get; set; } [Attr] public string? Attr3 { get; set; } [Attr] public bool Attr4 { get; set; } [Attr] public int Attr5 { get; set; } [Attr] public DateTime Attr6 { get; set; } [Attr] public DateTimeOffset Attr7 { get; set; } [Attr] public TimeSpan Attr8 { get; set; } [Attr] public DayOfWeek Attr9 { get; set; } } }
Caused by an unintentional breaking change in .NET SDK v7.0.200, which the latest AppVeyor image uses
…n request path ended with a slash. For example: /workItems/ => /workItems//1
Before: Expected element.GetInt32() to be 25, but found 2 (difference of -23). After: Expected responseDocument.Meta to be 25, but found 2 (difference of -23).
maurei
approved these changes
Mar 11, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Minor changes in the
QueryExpression
model shape, to make it easier to understand and consume. And a few other small changes. See the individual commits for details.QUALITY CHECKLIST