NetFramework dll called from Azure Fn + DbConnection

Copper Contributor

Hi! Two questions:

 

1) Is there any caveat/concern about calling .net 4.61 code from AzFn 3 ? we are porting our app from webapi to AzFn, but not ready to migrate all to netcore.

 

2) Currently each function opens and closes the SqlConnection to Azure Sql as soon as possible. Is there a better practice on AzFns? 

2 Replies

@dfirka1970 

1.  You should test calling .net 4.61 code on functions v3. Since the runtime is .net core, there's no guarantee that .net 4.61 code will run without any issues. If you need full .net framework you could try running on a runtime v1. 

2. Best practice is to reuse connections if possible. Check out this documentation page for more info: https://docs.microsoft.com/en-us/azure/azure-functions/manage-connections 

@dfirka1970 Yes this is possible using a shared project as one path (c# - .net core classlibrary calling .net framework class library - Stack Overflow (stackoverflow.com...)  One thing to note is that since .NET FX is not cross-platform you'll be limited to where you can run this .NET core application.  Also the 1.x version of Azure functions can run .NET Framework code natively: Azure Functions runtime versions overview | Microsoft Docs

 

There are some best practices posted here on SQL Connections in Azure functions: SQL connection pooling in Azure Functions - Stack Overflow (stackoverflow.com)