您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.

用于 .NET 的 Azure 数据工厂库Azure Data Factory libraries for .NET

概述Overview

Azure 数据工厂是基于云的数据集成服务。Azure Data Factory is a cloud-based data integration service. 使用它可在云中创建数据驱动的工作流,用于协调和自动化数据移动与数据转换。It enables you to create data-driven workflows in the cloud to orchestrate and automate data movement and data transformation.

有关详细信息,请参阅 Azure 数据工厂简介To learn more, read the Introduction to Azure Data Factory.

管理库 - 数据工厂 V2(预览版)Management library - Data Factory V2 (Preview)

使用数据工厂 V2(预览版)中的管理库可创建和计划数据驱动的工作流(管道)。Use the management library to create and schedule data-driven workflows (pipelines) in Data Factory V2 (Preview). 有关详细信息,请参阅使用 .NET SDK 创建数据工厂和管道For more information, see Create a data factory and pipeline using .NET SDK.

直接从 Visual Studio 包管理器控制台或使用 .NET Core CLI 安装 NuGet 包Install the NuGet package directly from the Visual Studio Package Manager console or with the .NET Core CLI.

Visual Studio 包管理器Visual Studio Package Manager

# Get the most recent prerelease package
Install-Package Microsoft.Azure.Management.DataFactory -Prerelease
# Be sure to include the most recent version from the NuGet package page
dotnet add package Microsoft.Azure.Management.DataFactory --version 0.2.0-preview

代码示例Code Example

以下示例使用管理库来创建数据工厂。The following example uses the management library to create a data factory.

/*
using Microsoft.Azure.Management.ResourceManager;
using Microsoft.Azure.Management.DataFactory;
using Microsoft.Azure.Management.DataFactory.Models;
*/

DataFactoryManagementClient client = new DataFactoryManagementClient(tokenCredentials) { SubscriptionId = subscriptionId };
Factory dataFactory = new Factory
{
    Location = region,
    Identity = new FactoryIdentity()
};
client.Factories.CreateOrUpdate(resourceGroup, dataFactoryName, dataFactory);

管理库 - 数据工厂 V1Management library - Data Factory V1

使用数据工厂版本 1 中的管理库可创建和计划数据驱动的工作流(管道)。Use the management library to create and schedule data-driven workflows (pipelines) in Data Factory Version 1. 有关详细信息,请查看数据工厂版本 1 的文档。For more information, review the documentation for Data Factory Version 1.

直接从 Visual Studio 包管理器控制台或使用 .NET Core CLI 安装 NuGet 包Install the NuGet package directly from the Visual Studio Package Manager console or with the .NET Core CLI.

Visual Studio 包管理器Visual Studio Package Manager

Install-Package Microsoft.Azure.Management.DataFactories
dotnet add package Microsoft.Azure.Management.DataFactories

代码示例Code Example

以下示例使用管理库来创建数据工厂。The following example uses the management library to create a data factory.

DataFactoryManagementClient client = new DataFactoryManagementClient(aadTokenCredentials, resourceManagerUri);
client.DataFactories.CreateOrUpdate(resourceGroupName,
    new DataFactoryCreateOrUpdateParameters()
    {
        DataFactory = new DataFactory()
        {
            Name = dataFactoryName,
            Location = "westus",
            Properties = new DataFactoryProperties()
        }
    }
);

示例Samples

详细了解可在应用中使用的示例 .NET 代码Explore more sample .NET code you can use in your apps.