Skip to content

Add async infrastructure for lazy-loading #10904

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 1 commit into from
Feb 7, 2018

Conversation

ajcvickers
Copy link
Contributor

Part of #10509, #3797

Adds ILazyLoader.LoadAsync and allows binding to delegate for it.


return ShouldLoad(entity, navigationName, out var entry)
? entry.LoadAsync(cancellationToken)
: Task.FromResult(0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use Task.CompletedTask

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this something we should now do everywhere? (Currently we use .FromResult(0) throughout the stack, based on recommendation from @AndriySvyryd)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it may not have been around previously.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any is fine for now, it'll be cleaned up by #7445

{
private readonly ICollection<LazyAsyncPsPost> _lazyAsyncPsPosts = new List<LazyAsyncPsPost>();

private Func<object, CancellationToken, string, Task> LazyLoader { get; set; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flip CancellationToken and name parameters?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should discuss in API review--name is CallerMemberName which should also be last, and the signature of this func must currently match the signature of the method (since there is no manipulation of the order, etc. when building the expression tree.)

@ajcvickers ajcvickers force-pushed the BungleSaysPaintTheWholeWorldWithARainbow branch from 4ea4c00 to 76cb459 Compare February 7, 2018 17:12
Part of #10509, #3797

Adds ILazyLoader.LoadAsync and allows binding to delegate for it.
@ajcvickers ajcvickers force-pushed the BungleSaysPaintTheWholeWorldWithARainbow branch from 76cb459 to 7a0ad41 Compare February 7, 2018 17:12
@ajcvickers ajcvickers merged commit 7a0ad41 into dev Feb 7, 2018
@dasMulli
Copy link

dasMulli commented Feb 8, 2018

Thanks for doing that, it is a great API addition!

@smitpatel smitpatel deleted the BungleSaysPaintTheWholeWorldWithARainbow branch February 11, 2018 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants