Dax.Formatter
1.1.0
See the version list below for details.
dotnet add package Dax.Formatter --version 1.1.0
NuGet\Install-Package Dax.Formatter -Version 1.1.0
<PackageReference Include="Dax.Formatter" Version="1.1.0" />
paket add Dax.Formatter --version 1.1.0
#r "nuget: Dax.Formatter, 1.1.0"
// Install Dax.Formatter as a Cake Addin #addin nuget:?package=Dax.Formatter&version=1.1.0 // Install Dax.Formatter as a Cake Tool #tool nuget:?package=Dax.Formatter&version=1.1.0
Dax Formatter
DAX Formatter is a service available at https://www.daxformatter.com.
The service receives DAX expressions and format them according to rules for DAX code formatting.
The NuGet package contains a client library to invoke the service from your .NET application.
All the requests are designed to be asynchronous.
You should minimize the requests made to the service: to format multiple expressions, use a single API call providing the DaxFormatterMultipleRequest
structure.
Quick guide
Create an instance of DaxFormatterClient
.
Invoke the FormatAsync
method for each request.
Possibly, use the DaxFormatterMultipleRequest
structure to provide more statistical details about the database and the server (all the names are anonymized and used only to count the number of unique servers/databases serviced).
DaxFormatterClient
The default constructor creates an instance of the client using the current assembly name and version to identify the client. You can specify an application name and version in the constructor arguments. The client instance resolve the server endpoint just once and reuse it in following requests. It is suggested to reuse the same instance in multiple requests to minimize the latency.
var formatter = new DaxFormatterClient();
var response = await formatter.FormatAsync( "evaluate('Table') order by 'Table'[Column]" );
DaxFormatterMultipleRequest
Use the DaxFormatterMultipleRequest
class to send multiple DAX expressions in a single API call.
var formatter = new DaxFormatterClient();
var request = new DaxFormatterMultipleRequest
{
DatabaseName = "MyDatabaseName", // The name will be anonymized by the client library
ServerName = "MyServerName", // The name will be anonymized by the client library
// Format arguments (you can skip all of them to keep the default values)
ListSeparator = ',',
DecimalSeparator = '.',
MaxLineLength = DaxFormatterLineStyle.LongLine,
SkipSpaceAfterFunctionName = DaxFormatterSpacingStyle.BestPractice,
// Identify the server type using the corresponding enum values
ServerMode = Dax.Formatter.AnalysisServices.ServerMode.Tabular,
ServerType = Dax.Formatter.AnalysisServices.ServerType.AnalysisServices,
ServerEdition = Dax.Formatter.AnalysisServices.ServerEdition.Enterprise,
ServerLocation = Dax.Formatter.AnalysisServices.ServerLocation.OnPremise,
};
// Add the code to format
request.Dax.Add( "evaluate('Table') order by 'Table'[Column]" );
request.Dax.Add( "[X]:=CALCULATE([Amt],USERELATIONSHIP(Sales[DueDateKey],'Date'[DateKey]))" );
// Send the request and wait the result
var responses = await formatter.FormatAsync(request);
// Process the result
foreach (var response in responses)
{
Console.WriteLine(response.Formatted);
}
DaxFormatterSingleRequest
Use the DaxFormatterSingleRequest
class to send one DAX expressions in a single API call.
var formatter = new DaxFormatterClient();
var request = new DaxFormatterSingleRequest
{
Dax = "evaluate('Table') order by 'Table'[Column]",
DatabaseName = "MyDatabaseName", // The name will be anonymized by the client library
ServerName = "MyServerName", // The name will be anonymized by the client library
// Format arguments (you can skip all of them to keep the default values)
ListSeparator = ',',
DecimalSeparator = '.',
MaxLineLength = DaxFormatterLineStyle.LongLine,
SkipSpaceAfterFunctionName = DaxFormatterSpacingStyle.BestPractice,
// Identify the server type using the corresponding enum values
ServerMode = Dax.Formatter.AnalysisServices.ServerMode.Tabular,
ServerType = Dax.Formatter.AnalysisServices.ServerType.AnalysisServices,
ServerEdition = Dax.Formatter.AnalysisServices.ServerEdition.Enterprise,
ServerLocation = Dax.Formatter.AnalysisServices.ServerLocation.OnPremise,
};
// Send the request and wait the result
var response = await formatter.FormatAsync(request);
// Display the result
Console.WriteLine(response.Formatted);
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- System.Security.Cryptography.ProtectedData (>= 6.0.0)
- System.Text.Json (>= 6.0.3)
-
net6.0
- System.Security.Cryptography.ProtectedData (>= 6.0.0)
- System.Text.Json (>= 6.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.2.0 | 93 | 11/17/2024 |
1.1.1 | 8,384 | 5/11/2022 |
1.1.0 | 787 | 4/26/2022 |
1.1.0-preview1 | 230 | 4/24/2022 |
1.0.0 | 2,384 | 3/6/2021 |