简体   繁体   中英

Azure DocumentDB and Azure Blob Storage

I'm using azure document db in my ASP.net MVC application.And currently I'm having 2 collections in it which are Employees and Tasks. Currently everything is working fine with document db operations.

But I couldn't find a way to upload multiple images(not multiple images at once ) against a document. eg: assume I need to store 2 employee pictures against a single employee document.

I've read about the azure blob storage and think I can use it for the file uploads.But the thing that I can unable to clarify is how to keep the references of the uploaded files in each employee documents .

Is there any way to do that?

I've read about the azure blob storage and think I can use it for the file uploads.But the thing that I can unable to clarify is how to keep the references of the uploaded files in each employee documents.

Each blob in blob storage is accessible via a URL. What you could do is save these URLs along with the document. For example, your Employee JSON could look like:

Employee = {
  'Id': '0001',
  'Name': 'Some Name',
  'Pictures': [
    'https://account.blob.core.windows.net/container/image1.png',
    'https://account.blob.core.windows.net/container/image2.png'
  ]
}

Other thing you could do is look at Attachments in DocumentDB.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM