Skip to content

Commit f00ccd5

Browse files
committed
Reverting changes to EssSharp.csproj from updating the generator, adding GetDimensionTag/Async(), Adding new properties to EssJobDimensionOptions and EssJobLoadDataOptions
1 parent ae428eb commit f00ccd5

8 files changed

Lines changed: 108 additions & 37 deletions

File tree

src/EssSharp.Abstractions/Concrete/EssJobBuildDimensionOptions.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ namespace EssSharp
77
{
88
public class EssJobBuildDimensionOptions : EssJobOptions, IEssJobOptions
99
{
10+
/// <summary />
11+
public EssJobBuildDimensionOptions() : base(EssJobType.Dimbuild)
12+
{
13+
}
14+
1015
/// <summary />
1116
public EssJobBuildDimensionOptions( string dataFilePath = null, string ruleFilePath = null, string applicationName = null, string connection = null, string cubeName = null, bool? forceDimBuild = null, string password = null, EssRestructureOption? restructureOption = null, string username = null ) : base(EssJobType.Dimbuild)
1217
{

src/EssSharp.Abstractions/Concrete/EssJobLoadDataOptions.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ namespace EssSharp
77
/// <summary />
88
public class EssJobLoadDataOptions : EssJobOptions, IEssJobOptions
99
{
10+
/// <summary />
11+
public EssJobLoadDataOptions() : base(EssJobType.Dataload)
12+
{
13+
14+
}
15+
1016
/// <summary />
1117
public EssJobLoadDataOptions(string dataFilePath = null, string ruleFilePath = null, string applicationName = null, string cubeName = null, bool? abortOnError = false, string connection = null, string password = null, string username = null ) : base(EssJobType.Dataload)
1218
{

src/EssSharp.Abstractions/IEssDimension.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public interface IEssDimension : IEssObject
2323
public int MemberCount { get; }
2424

2525
/// <summary>
26-
/// Gets stored Dimesnion members.
26+
/// Gets the stored dimension members count.
2727
/// </summary>
2828
public int StoredMemberCount { get; }
2929

@@ -32,6 +32,9 @@ public interface IEssDimension : IEssObject
3232
/// </summary>
3333
public List<string> Members { get; set; }
3434

35+
/// <summary>
36+
/// Returns the dimension tag.
37+
/// </summary>
3538
public EssDimensionType DimensionTag { get; }
3639

3740
/// <summary>
@@ -47,6 +50,17 @@ public interface IEssDimension : IEssObject
4750
/// <returns></returns>
4851
public Task<List<IEssMember>> GetChildrenAsync(CancellationToken cancellationToken = default);
4952

53+
/// <summary>
54+
/// Gets the dimension tag for the current dimension.
55+
/// </summary>
56+
public EssDimensionType GetDimensionTag();
57+
58+
/// <summary>
59+
/// Asynchronously gets the dimension tag for the current dimension.
60+
/// </summary>
61+
/// <param name="cancellationToken"></param>
62+
public Task<EssDimensionType> GetDimensionTagAsync( CancellationToken cancellationToken = default );
63+
5064
/// <summary>
5165
///
5266
/// </summary>

src/EssSharp/Client/ApiClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ private async Task<ApiResponse<T>> ExecClientAsync<T>(Func<RestClient, Task<Rest
536536
}
537537

538538
// Allow any custom extensions to process the response after dispatch.
539-
InterceptResponseAsync(request, response, configuration, options).GetAwaiter().GetResult();
539+
await InterceptResponseAsync(request, response, configuration, options, cancellationToken).ConfigureAwait(false);
540540

541541
var result = ToApiResponse(response);
542542
if (response.ErrorMessage != null)

src/EssSharp/EssDimension.cs

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ public class EssDimension : EssObject, IEssDimension
1212
{
1313
#region Private Data
1414

15-
private readonly EssCube _cube;
16-
private readonly DimensionBean _dimension;
15+
private readonly EssCube _cube;
16+
private readonly DimensionBean _dimension;
17+
private EssDimensionType? _dimensionTag;
1718

1819
#endregion
1920

@@ -57,7 +58,8 @@ internal EssDimension( DimensionBean dimension, EssCube cube ) : base(cube?.Conf
5758
public List<string> Members { get; set; }
5859

5960
/// <inheritdoc />
60-
public EssDimensionType DimensionTag => _cube.GetMember(Name).DimensionType;
61+
public EssDimensionType DimensionTag => GetDimensionTag();
62+
6163
#endregion
6264

6365
/// <inheritdoc />
@@ -73,7 +75,7 @@ internal EssDimension( DimensionBean dimension, EssCube cube ) : base(cube?.Conf
7375
{
7476
var api = GetApi<OutlineViewerApi>();
7577

76-
if ( await api.OutlineGetMembersAsync(app: _cube.Application.Name, cube: _cube.Name, parent: Name).ConfigureAwait(false) is not { } members )
78+
if ( await api.OutlineGetMembersAsync(app: _cube.Application.Name, cube: _cube.Name, parent: Name, cancellationToken: cancellationToken).ConfigureAwait(false) is not { } members )
7779
throw new Exception("Cannot get members"); // TODO: update later
7880

7981
return members.ToEssSharpList(_cube) ?? new List<IEssMember>();
@@ -85,19 +87,40 @@ internal EssDimension( DimensionBean dimension, EssCube cube ) : base(cube?.Conf
8587
}
8688
}
8789

88-
/// inheritdoc />
89-
/// <returns></returns>
90+
/// <inheritdoc />
91+
public EssDimensionType GetDimensionTag() => GetDimensionTagAsync().GetAwaiter().GetResult();
92+
93+
/// <inheritdoc />
94+
public async Task<EssDimensionType> GetDimensionTagAsync(CancellationToken cancellationToken = default)
95+
{
96+
try
97+
{
98+
if ( _dimensionTag.HasValue )
99+
return _dimensionTag.Value;
100+
101+
if ( await _cube.GetMemberAsync(Name, cancellationToken: cancellationToken).ConfigureAwait(false) is not { } member )
102+
throw new Exception("Cannot get dimension member.");
103+
104+
return (_dimensionTag = member.DimensionType).Value;
105+
}
106+
catch (OperationCanceledException) { throw; }
107+
catch (Exception e)
108+
{
109+
throw new Exception($@"Unable to get the dimension tag for dimension ""{Name}"". {e.Message}", e);
110+
}
111+
}
112+
113+
/// <inheritdoc />
90114
public List<IEssGeneration> GetGenerations() => GetGenerationsAsync().GetAwaiter().GetResult();
91115

92-
/// inheritdoc />
93-
/// <returns></returns>
116+
/// <inheritdoc />
94117
public async Task<List<IEssGeneration>> GetGenerationsAsync( CancellationToken cancellationToken = default )
95118
{
96119
try
97120
{
98121
var api = GetApi<DimensionsApi>();
99122

100-
if ( await api.DimensionsListDimGenerationsAsync(applicationName: _cube.Application.Name, databaseName: _cube.Name, dimensionName: Name).ConfigureAwait(false) is not { } generations )
123+
if ( await api.DimensionsListDimGenerationsAsync(applicationName: _cube.Application.Name, databaseName: _cube.Name, dimensionName: Name, cancellationToken: cancellationToken).ConfigureAwait(false) is not { } generations )
101124
throw new Exception("Cannot get generations"); // TODO: update later
102125

103126
return generations.ToEssSharpList() ?? new List<IEssGeneration>();
@@ -121,7 +144,7 @@ internal EssDimension( DimensionBean dimension, EssCube cube ) : base(cube?.Conf
121144
{
122145
var api = GetApi<DimensionsApi>();
123146

124-
if ( await api.DimensionsListDimGenerationsAsync(applicationName: _cube.Application.Name, databaseName: _cube.Name, dimensionName: Name).ConfigureAwait(false) is not { } generations )
147+
if ( await api.DimensionsListDimGenerationsAsync(applicationName: _cube.Application.Name, databaseName: _cube.Name, dimensionName: Name, cancellationToken: cancellationToken).ConfigureAwait(false) is not { } generations )
125148
throw new Exception("Cannot get generations"); // TODO: update later
126149

127150
return generations.ToEssSharpList() ?? new List<IEssGeneration>();
@@ -145,7 +168,7 @@ internal EssDimension( DimensionBean dimension, EssCube cube ) : base(cube?.Conf
145168
{
146169
var api = GetApi<DimensionsApi>();
147170

148-
if ( await api.DimensionsListDimLevelsAsync(applicationName: _cube.Application.Name, databaseName: _cube.Name, dimensionName: Name).ConfigureAwait(false) is not { } generations )
171+
if ( await api.DimensionsListDimLevelsAsync(applicationName: _cube.Application.Name, databaseName: _cube.Name, dimensionName: Name, cancellationToken: cancellationToken).ConfigureAwait(false) is not { } generations )
149172
throw new Exception("Cannot get generations"); // TODO: update later
150173

151174
return generations.ToEssSharpList() ?? new List<IEssGeneration>();

src/EssSharp/EssSharp.csproj

Lines changed: 43 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,47 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<GenerateAssemblyInfo>false</GenerateAssemblyInfo><!-- setting GenerateAssemblyInfo to false causes this bug https://github.com/dotnet/project-system/issues/3934 -->
4+
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
55
<TargetFramework>netstandard2.0</TargetFramework>
6+
<LangVersion>latest</LangVersion>
67
<AssemblyName>EssSharp</AssemblyName>
7-
<PackageId>EssSharp</PackageId>
8-
<OutputType>Library</OutputType>
9-
<Authors>OpenAPI</Authors>
10-
<Company>OpenAPI</Company>
11-
<AssemblyTitle>OpenAPI Library</AssemblyTitle>
12-
<Description>A library generated from a OpenAPI doc</Description>
13-
<Copyright>No Copyright</Copyright>
8+
<AssemblyTitle>$(AssemblyName)</AssemblyTitle>
149
<RootNamespace>EssSharp</RootNamespace>
15-
<Version>1.0.0</Version>
10+
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
11+
<PackageId>$(AssemblyName)</PackageId>
12+
<Title>$(AssemblyName)</Title>
13+
<Authors>Applied OLAP</Authors>
14+
<Company>$(Authors)</Company>
15+
<Description>A (partly) auto-generated C# REST client for Essbase.</Description>
16+
<Copyright>© $([System.DateTime]::UtcNow.ToString('yyyy')) Applied OLAP, Inc.</Copyright>
1617
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\EssSharp.xml</DocumentationFile>
17-
<RepositoryUrl>https://github.com/GIT_USER_ID/GIT_REPO_ID.git</RepositoryUrl>
18+
<RepositoryUrl>https://github.com/appliedolap/EssSharp.git</RepositoryUrl>
1819
<RepositoryType>git</RepositoryType>
19-
<PackageReleaseNotes>Minor update</PackageReleaseNotes>
20-
<ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally>
21-
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
22-
<LangVersion>latest</LangVersion>
20+
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
21+
<VersionPrefix>0.3.0</VersionPrefix>
22+
<VersionSuffix>beta</VersionSuffix>
23+
<!-- Strong Name Signing -->
24+
<SignAssembly>true</SignAssembly>
25+
<AssemblyOriginatorKeyFile>EssSharp.snk</AssemblyOriginatorKeyFile>
26+
<!-- NuGet Package Options -->
27+
<PackageReadmeFile>README.md</PackageReadmeFile>
28+
<!-- SourceLink Options -->
29+
<PublishRepositoryUrl>true</PublishRepositoryUrl>
30+
<EmbedUntrackedSources>true</EmbedUntrackedSources>
31+
<IncludeSymbols>true</IncludeSymbols>
32+
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
33+
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
2334
</PropertyGroup>
2435

2536
<ItemGroup>
37+
<!-- NuGet Readme -->
38+
<None Include="..\..\README.md" Pack="true" PackagePath="\" />
39+
</ItemGroup>
40+
41+
<ItemGroup>
42+
<!-- Project References -->
43+
<ProjectReference Include="..\EssSharp.Abstractions\EssSharp.Abstractions.csproj" />
44+
<!-- Package References -->
2645
<PackageReference Include="JsonSubTypes" Version="2.0.1" />
2746
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.4" />
2847
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
@@ -31,13 +50,17 @@
3150
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
3251
<PackageReference Include="System.Text.Json" Version="9.0.4" />
3352
<PackageReference Include="TinyCsvParser" Version="2.7.1" />
34-
</ItemGroup>
35-
36-
<ItemGroup>
53+
<!-- Excluded References -->
3754
<None Remove="System.Web" />
3855
</ItemGroup>
3956

40-
<ItemGroup>
41-
<ProjectReference Include="..\EssSharp.Abstractions\EssSharp.Abstractions.csproj" />
42-
</ItemGroup>
57+
<Target Name="SetVersionSuffix" BeforeTargets="Build">
58+
<!-- Utilize Semantic Versioning for prereleases, i.e., when there is a VersionSuffix -->
59+
<!-- Example: 0.1.0-beta.20230510114220. -->
60+
<PropertyGroup Condition="'$(VersionSuffix)' != ''">
61+
<VersionSuffix Condition="'$(DesignTimeBuild)' != 'true' OR '$(BuildingProject)' == 'true'">$(VersionSuffix).$([System.DateTime]::UtcNow.ToString("yyyyMMddHHmmss"))</VersionSuffix>
62+
<PackageVersion>$(VersionPrefix)-$(VersionSuffix)</PackageVersion>
63+
</PropertyGroup>
64+
</Target>
65+
4366
</Project>

src/EssSharp/Extensions/Partials/ApiClient.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,12 @@ private partial async Task InterceptRequestAsync( RestRequest request, IReadable
101101
}
102102

103103
// Set the grid preferences for the session.
104-
await setGridPreferencesAsync(configuredPreferences, cookie);
104+
await setGridPreferencesAsync(configuredPreferences, cookie).ConfigureAwait(false);
105105
}
106106
else
107107
{
108108
// Set the grid preferences for a new session.
109-
await setGridPreferencesAsync(configuredPreferences);
109+
await setGridPreferencesAsync(configuredPreferences).ConfigureAwait(false);
110110
}
111111

112112
// Write the request to any configured logger.
@@ -130,7 +130,7 @@ async Task setGridPreferencesAsync( EssGridPreferences preferences, Cookie cooki
130130

131131
var api = ApiFactory.GetApiAndClient<GridPreferencesApi>(config).Api;
132132

133-
var sessionID = (await api.GridPreferencesSetForSessionAsync(preferences.ToModelObject(), cookie)).Cookies.FirstOrDefault(cookie => string.Equals(cookie?.Name, @"JSESSIONID", StringComparison.OrdinalIgnoreCase) && !cookie.Expired )?.Value;
133+
var sessionID = (await api.GridPreferencesSetForSessionAsync(preferences.ToModelObject(), cookie, cancellationToken: cancellationToken).ConfigureAwait(false)).Cookies.FirstOrDefault(cookie => string.Equals(cookie?.Name, @"JSESSIONID", StringComparison.OrdinalIgnoreCase) && !cookie.Expired )?.Value;
134134

135135
if ( !string.IsNullOrEmpty(sessionID) )
136136
{

templates/ApiClient.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ namespace {{packageName}}.Client
555555
}
556556
557557
// Allow any custom extensions to process the response after dispatch.
558-
InterceptResponseAsync(request, response, configuration, options).GetAwaiter().GetResult();
558+
await InterceptResponseAsync(request, response, configuration, options, cancellationToken).ConfigureAwait(false);
559559
560560
var result = ToApiResponse(response);
561561
if (response.ErrorMessage != null)

0 commit comments

Comments
 (0)