Start a new topic

Make IAssetService return string instead of void

Question from Giedrius:

As long as it's implementation is following:
public string Upload(UploadStreamInfo info)
return BlobStorageProvider.Upload(info);

and BlobStorageProvider.Upload always returning string, I don't see the reason, why it shouldn't be bubbled up. Returned string at least in Azure case is needed to know what full uri is after upload.

Best Answer

ok, that makes sense, we'll just need to return MessageContract back

I agree, there is really no reason to not return the path. We will make changes to the specified interface for the next release.

Actually there is a reason to return void, since the method uses MessageContractAttribute we can only return void or another object of type MessageContract.

I've noticed the reason also after I've created the ticket, but I need a way to know where asset will be saved, as to know full path I would need to access CloudBlobClient and I don't wish to do that, as I'm using IAssetService abstraction. 

For example, when creating import job, template path is "devstoreaccount1/default-container/jewelry_template.csv". Container name and file name I'm passing by my self, so there's no problem with that, but account name is coming for somewhere deeper, and I should not care from where, I should know that from IAssetService somehow (file storage will behave differently, so I don't think it would be clever to add additional method to IAssetService to get storage account or smth., in such case I think best way would be to receive saved path from Upload method itself).


ok, that makes sense, we'll just need to return MessageContract back

Login or Signup to post a comment