Skip to content
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

Fix Media Cache Handler #16992

Merged
merged 2 commits into from
Nov 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,11 @@ public DefaultMediaFileStoreCacheEventHandler(IMediaFileStoreCacheFileProvider m
}

public override Task MediaDeletedDirectoryAsync(MediaDeletedContext context)
{
_mediaFileStoreCacheFileProvider.TryDeleteDirectoryAsync(context.Path);

return Task.CompletedTask;
}
=> _mediaFileStoreCacheFileProvider.TryDeleteDirectoryAsync(context.Path);
Copy link
Member

Choose a reason for hiding this comment

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

I think we accepted the rule to use block body for methods, ctor and conversions. Only use expression body for properties and indexers.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think there was an objection into using expression for one line like this.

Copy link
Member

Choose a reason for hiding this comment

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

I looked at the editor config and watched the meeting. You are correct, for methods we "can" use expression bodies when it is on a single line.


public override Task MediaDeletedFileAsync(MediaDeletedContext context)
{
_mediaFileStoreCacheFileProvider.TryDeleteFileAsync(context.Path);

return Task.CompletedTask;
}
=> _mediaFileStoreCacheFileProvider.TryDeleteFileAsync(context.Path);

public override Task MediaMovedAsync(MediaMoveContext context)
{
_mediaFileStoreCacheFileProvider.TryDeleteFileAsync(context.OldPath);

return Task.CompletedTask;
}
=> _mediaFileStoreCacheFileProvider.TryDeleteFileAsync(context.OldPath);
}