Skip to content
Discussion options

You must be logged in to vote

The trick is to keep the shared model framework-agnostic and only adapt to the Refit/ASP.NET types at the edges.

Things to know:

  • Refit multipart parameters accept plain Stream, FileInfo, byte[] and string directly. You do not have to use StreamPart in your shared types. StreamPart/ByteArrayPart/FileInfoPart only add control over file name and content type.
  • IFormFile is an ASP.NET Core abstraction (Microsoft.AspNetCore.Http). Refit does not consume it directly, so do not put IFormFile in a model shared with non-ASP.NET clients.

Recommended layout:

  • In the shared library, model the upload with primitives: a Stream (or byte[]) plus optional FileName/ContentType strings. No Refit and no ASP…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by glennawatson
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants