DEV Community

Cover image for How YOU can build a Serverless C# .Net Core API in no time, with bindings and a Database

How YOU can build a Serverless C# .Net Core API in no time, with bindings and a Database

Chris Noring on September 13, 2019

Follow me on Twitter, happy to take your suggestions on topics or improvements /Chris This article is part of #ServerlessSeptember. You'll find ot...
Collapse
 
hugoimran profile image
Imran Hugo

Hi Chris

Thanks for the awesome article. Just wondering if it is possible to have the single inbound trigger with two outbound bindings. The first being a CosmosDb collection and the second being a queue.

The queue message however needs to have the Id of the entry in the CosmosDb.

OR

Would it be better to have it write to the collection in using the inbound trigger and then create a second function with the CosmosDbTrigger which would be triggered when the new document is added. This would then write to a queue from processing.

Collapse
 
softchris profile image
Chris Noring

You can have two output bindings.. I would say though that your second scenario is what I would do.

Collapse
 
hugoimran profile image
Imran Hugo

Hi Chris,

Thanks for the response...I appreciate it. On a seperate topic, have spend quite a fair amount of time on R&D with regards to Azure Index Service, but I am quite interested in how you would utilise Azure Storage. In particular, if I have a bunch of image thumbnails which I have created using a resizer function in Azure...how do I serve these to my web application?

I currently have an onprem application that serves them from a server disk...would I just use the thumbnail URI generated from Azure when it is stored? And if so, how could I use a custom domain for them i.e. myapplication.com/thumbnail/{id}

Collapse
 
ferdeen profile image
Ferdeen Mughal

Hi Chris,

Really good article!

The first c# class example, Id should be of type string, not int.(As I was getting an Exception binding Parameter 'bookmark'. Newtonsoft.Json: Could not convert string to integer).

I'm attempting this demo in vs2019.

Cheers,

Ferdeen

Collapse
 
softchris profile image
Chris Noring

hi Ferdeen.. Yes I've noticed myself. The code is changed later in the article, I missed that first instance. I'll update.. Sorry you got stuck.

Collapse
 
redowl3 profile image
redowl3

Could you provide an example using vs2019 as well?

Collapse
 
softchris profile image
Chris Noring

sure, in a future article :)

Collapse
 
bananbe profile image
Mateusz

Really good post! I started using Azure Functions recently and this helped me understand them better :)

Collapse
 
softchris profile image
Chris Noring

Thank you Mateusz :)