public static ValueTask<(IFile File, ValidationResult Result)> CreateFileAsync(
this IFileSource source,
string name,
IFileType? type,
IFileCategory? category,
Func<CancellationToken, ValueTask<IFileContent>> createContentFuncAsync,
IUser? user = null,
Func<IFileCreationToken, CancellationToken, ValueTask>? modifyFileTokenActionAsync = null,
Func<IFileVersionCreationToken, CancellationToken, ValueTask>? modifyVersionTokenActionAsync = null,
CancellationToken cancellationToken = default
)
<ExtensionAttribute>
Public Shared Function CreateFileAsync (
source As IFileSource,
name As String,
type As IFileType,
category As IFileCategory,
createContentFuncAsync As Func(Of CancellationToken, ValueTask(Of IFileContent)),
Optional user As IUser = Nothing,
Optional modifyFileTokenActionAsync As Func(Of IFileCreationToken, CancellationToken, ValueTask) = Nothing,
Optional modifyVersionTokenActionAsync As Func(Of IFileVersionCreationToken, CancellationToken, ValueTask) = Nothing,
Optional cancellationToken As CancellationToken = Nothing
) As ValueTask(Of (File As IFile, Result As ValidationResult))
public:
[ExtensionAttribute]
static ValueTask<ValueTuple<IFile^, ValidationResult^>> CreateFileAsync(
IFileSource^ source,
String^ name,
IFileType^ type,
IFileCategory^ category,
Func<CancellationToken, ValueTask<IFileContent^>>^ createContentFuncAsync,
IUser^ user = nullptr,
Func<IFileCreationToken^, CancellationToken, ValueTask>^ modifyFileTokenActionAsync = nullptr,
Func<IFileVersionCreationToken^, CancellationToken, ValueTask>^ modifyVersionTokenActionAsync = nullptr,
CancellationToken cancellationToken = CancellationToken()
)
[<ExtensionAttribute>]
static member CreateFileAsync :
source : IFileSource *
name : string *
type : IFileType *
category : IFileCategory *
createContentFuncAsync : Func<CancellationToken, ValueTask<IFileContent>> *
?user : IUser *
?modifyFileTokenActionAsync : Func<IFileCreationToken, CancellationToken, ValueTask> *
?modifyVersionTokenActionAsync : Func<IFileVersionCreationToken, CancellationToken, ValueTask> *
?cancellationToken : CancellationToken
(* Defaults:
let _user = defaultArg user null
let _modifyFileTokenActionAsync = defaultArg modifyFileTokenActionAsync null
let _modifyVersionTokenActionAsync = defaultArg modifyVersionTokenActionAsync null
let _cancellationToken = defaultArg cancellationToken new CancellationToken()
*)
-> ValueTask<ValueTuple<IFile, ValidationResult>>
Функция, создающая контент файла, или null, если создаётся обычный контент в локальном кэше. Если функция возвращает null, то контент также будет создан в локальном кэше.
Рекомендуется задавать функцию для создания контента, доступного удалённо и не сохраняемого в кэше.