You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/stream-analytics/stream-analytics-edge-csharp-udf.md
+16-10Lines changed: 16 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,17 +1,23 @@
1
1
---
2
2
title: Tutorial - Write C# user defined functions for Azure Stream Analytics jobs in Visual Studio (Preview)
3
-
description: This tutorial shows how to write c# user defined functions for Stream Analytics jobs in Visual Studio.
3
+
description: This tutorial shows how to write C# user defined functions for Stream Analytics jobs in Visual Studio.
4
4
author: ajetasin
5
5
ms.author: ajetasi
6
6
ms.service: stream-analytics
7
7
ms.topic: tutorial
8
-
ms.date: 12/06/2018
8
+
ms.date: 03/29/2023
9
9
ms.custom: "seodec18, devx-track-csharp"
10
10
---
11
11
12
12
# Tutorial: Write a C# user-defined function for Azure Stream Analytics job (Preview)
13
13
14
-
C# user-defined functions (UDFs) created in Visual Studio allow you to extend the Azure Stream Analytics query language with your own functions. You can reuse existing code (including DLLs) and use mathematical or complex logic with C#. There are three ways to implement UDFs: CodeBehind files in a Stream Analytics project, UDFs from a local C# project, or UDFs from an existing package from a storage account. This tutorial uses the CodeBehind method to implement a basic C# function. The UDF feature for Stream Analytics jobs is currently in preview and shouldn't be used in production workloads.
14
+
C# user-defined functions (UDFs) created in Visual Studio allow you to extend the Azure Stream Analytics query language with your own functions. You can reuse existing code (including DLLs) and use mathematical or complex logic with C#. There are three ways to implement UDFs:
15
+
16
+
- CodeBehind files in a Stream Analytics project
17
+
- UDFs from a local C# project
18
+
- UDFs from an existing package from a storage account.
19
+
20
+
This tutorial uses the CodeBehind method to implement a basic C# function. The UDF feature for Stream Analytics jobs is currently in preview and shouldn't be used in production workloads.
15
21
16
22
In this tutorial, you learn how to:
17
23
@@ -26,11 +32,11 @@ Before you start, make sure you've completed the following prerequisites:
26
32
27
33
* If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
28
34
* Install [Stream Analytics tools for Visual Studio](stream-analytics-tools-for-visual-studio-install.md) and the **Azure development** or **Data Storage and Processing** workloads.
29
-
* Take a look at the existing [Stream Analytics Edge development guide](stream-analytics-tools-for-visual-studio-edge-jobs.md) if you are building an IoT Edge job.
35
+
* Take a look at the existing [Stream Analytics Edge development guide](stream-analytics-tools-for-visual-studio-edge-jobs.md) if you're building an IoT Edge job.
30
36
31
37
## Create a container in your Azure Storage Account
32
38
33
-
The container you create will be used to store the compiled C# package. If you create an Edge job, this storage account will also be used to deploy the package to your IoT Edge device. Use a dedicated container for each Stream Analytics job. Reusing the same container for multiple Stream Analytics Edge jobs is not supported. If you already have a storage account with existing containers, you may use them. If not, you'll need to [create a new container](../storage/blobs/storage-quickstart-blobs-portal.md).
39
+
The container you create is used to store the compiled C# package. If you create an Edge job, this storage account is also used to deploy the package to your IoT Edge device. Use a dedicated container for each Stream Analytics job. Reusing the same container for multiple Stream Analytics Edge jobs isn't supported. If you already have a storage account with existing containers, you may use them. If not, you need to [create a new container](../storage/blobs/storage-quickstart-blobs-portal.md).
34
40
35
41
## Create a Stream Analytics project in Visual Studio
36
42
@@ -48,7 +54,7 @@ The container you create will be used to store the compiled C# package. If you c
48
54
49
55
1. Open Visual Studio and navigate to the **Solution Explorer**.
50
56
51
-
2. Double-click the job configuration file, `EdgeJobConfig.json`.
57
+
2. Double-click the job configuration file, `JobConfig.json`.
52
58
53
59
3. Expand the **User-Defined Code Configuration** section, and fill out the configuration with the following suggested values:
54
60
@@ -63,7 +69,7 @@ The container you create will be used to store the compiled C# package. If you c
63
69
64
70
65
71
## Write a C# UDF with CodeBehind
66
-
A CodeBehind file is a C# file associated with a single ASA query script. Visual Studio tools will automatically zip the CodeBehind file and upload it to your Azure storage account upon submission. All classes must be defined as *public* and all objects must be defined as *static public*.
72
+
A CodeBehind file is a C# file associated with a single ASA query script. Visual Studio tools automatically zips the CodeBehind file and upload it to your Azure storage account upon submission. All classes must be defined as *public* and all objects must be defined as *static public*.
67
73
68
74
1. In **Solution Explorer**, expand **Script.asql** to find the **Script.asaql.cs** CodeBehind file.
69
75
@@ -93,7 +99,7 @@ A CodeBehind file is a C# file associated with a single ASA query script. Visual
0 commit comments