对 Azure Datalake 域名使用常量

Use constant for Azure Datalake domain name

有没有一种方法可以使用 Microsoft.Azure.DataLake.Store Nuget 包(或其他地方)中的常量来指定 Azure Data Lake Store 域名,而无需将 {dataLakeName}.azuredatalakestore.net 硬编码到代码库中?

我正在使用 AdlsClient.CreateClient(dataLakeFqdn, serviceCredentials);

更新:

您可以通过 source code.

对于方法 AdlsClient.CreateClient(dataLakeFqdn, serviceCredentials);,它是 here。在方法内部,它调用构造函数方法new AdlsClient(accountFqdn, Interlocked.Increment(ref _atomicClientId), creds);

当你导航到上面提到的构造函数时,它列出了 here in source code. And inside the constructor method, you can see it calls IsValidAccount method. And IsValidAccount 方法只做了一个正则表达式匹配操作:return Regex.IsMatch(accnt, @"^[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-][a-zA-Z0-9.\-]*$");.

直接在source code here中搜索azuredatalakestore.net即可,设置搜索范围为"in this repository"。搜索结果中没有azuredatalakestore.net是sdk定义的。大家可以按照这个截图进行搜索:


没有

由于 dataLakeName 是由您提供的,如果没有您的输入或硬编码,SDK 或其他方法如何知道 dataLakeName?

而且我不确定您为什么要避免对 {dataLakeName}.azuredatalakestore.net 进行硬编码,这里硬编码应该是最简单的方法。

如果您有任何疑虑,请告诉我。