c# - Azure function to connect to both blob and sql storage -


i have thought perfect introduction test case azure functions.

we have sql store in azure (sql database).

using c#, vs 2017, updated azure workflow items.

we have blob storage. each night need process go sql database, collect group of records based on criteria , process them generating file stored in blob storage.

i cannot seem on hump of getting either of these tasks done. of tutorials seem of basic type.

i have function created in vs 2017, first step connect sql database.

i went add new item: ado.net entity data model, , acted created model correct there not data context it?

so, decided try next step -- creating blob , use sample data hard coded. again...cannot find guide on how that.

i have "azurewebjobsstorage" setting in local.setting.json file.

i have timer function below:

 public static class function1 {     [functionname("function1")]     public static void run([timertrigger("0 */5 * * * *")]timerinfo mytimer, tracewriter log)     {         log.info($"c# timer trigger function executed at: {datetime.now}");        } 

just pointing in right direction , keep banging away @ it...

joe

so, need function with

here sketch function:

[functionname("function1")] public static void run(     [timertrigger("0 */5 * * * *")] timerinfo mytimer,      [blob("mycontainer/myblob.txt", fileaccess.write)] out string outputblob,     tracewriter log) {     var str = configurationmanager.connectionstrings["sqldb_connection"].connectionstring;     using (var conn = new sqlconnection(str))     {         conn.open();         var text = "select count(*) mydata";          using (var cmd = new sqlcommand(text, conn))         {             // execute command , log # rows affected.             var rows = cmd.executescalar();             outputblob = $"{rows} rows found";         }     } } 

your question bit open-ended, feel free update more details struggles.


Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -