Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Serverless computing in Azure with .NET

You're reading from  Serverless computing in Azure with .NET

Product type Book
Published in Aug 2017
Publisher Packt
ISBN-13 9781787288393
Pages 468 pages
Edition 1st Edition
Languages

Table of Contents (23) Chapters

Title Page
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Customer Feedback
Preface
1. Understanding Serverless Architecture 2. Getting Started with the Azure Environment 3. Setting Up the Development Environment 4. Configuring Endpoints, Triggers, Bindings, and Scheduling 5. Integrations and Dependencies 6. Integrating Azure Functions with Cognitive Services API 7. Debugging Your Azure Functions 8. Testing Your Azure Functions 9. Configuring Continuous Delivery 10. Securing Your Application 11. Monitoring Your Application 12. Designing for High Availability, Disaster Recovery, and Scale 13. Designing Cost-Effective Services 14. C# Script-Based Functions 15. Azure Compute On-Demand Options

Sharing code between functions


In a C# script-based Function App, adding a new file to one of the functions will not make it available to other functions in the application.

To share code between functions, we will need to do the following two things:

  • Create a folder named Shared at the root level of a Function App, and add shared code files to this folder. The WebJobs SDK (that Azure Functions are based on) watches for any code changes in the Shared folder and makes sure that the changes are picked up by the functions.
  • Create #load directives to the specific location of the shared files in each function that references the shared code.

Note

You can add other folders to the function's watch list by modifying the watchDirectories setting of the WebJobs host here at https://github.com/Azure/azure-webjobs-sdk-script/wiki/host.json.

To show an example of the process, we will create a C# script-based version of the ScoreTweet function.

To share code between C# script-based functions in the same Function...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}