-
Notifications
You must be signed in to change notification settings - Fork 14
File upload
Stanislav Silin edited this page Apr 17, 2023
·
1 revision
The ZeroQL supports file uploading via the "official" GraphQL way - the Upload type. There is an example:
public record AddAvatar(int Id, Upload File) : GraphQL<Mutation, int>
{
public override int Execute(Mutation mutation)
=> mutation.AddUserProfileImage(Id, File);
}
There is one nuance associated with the
Upload
type. Pay attention to how you pass theUpload
instance. For example, if it is a anonymous typenew { File = new Upload("image.png", new MemoryStream()) }
that means that reflection is going to be utilized to get the value. As a result, the Reflection.Emit is involved, which can be an issue in AOT scenarios. So, the "request" syntax would be better for such a case.