Skip to content

Commit 43205e9

Browse files
authored
Merge pull request #42 from tableau/release/5.0.0
Release 5.0.0
2 parents 587b9dc + 9460621 commit 43205e9

File tree

158 files changed

+5150
-1444
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

158 files changed

+5150
-1444
lines changed

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<Nullable>enable</Nullable>
55
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
66
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
7-
<Version>4.3.1</Version>
7+
<Version>5.0.0</Version>
88
<Authors>Salesforce, Inc.</Authors>
99
<Company>Salesforce, Inc.</Company>
1010
<Copyright>Copyright (c) 2024, Salesforce, Inc. and its licensors</Copyright>

examples/Csharp.ExampleApplication/Csharp.ExampleApplication.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<OutputType>Exe</OutputType>
4-
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
4+
<TargetFrameworks>net8.0</TargetFrameworks>
55
<!-- Don't warn on ConfigureAwait on console application, Don't require license headers for sample code -->
66
<NoWarn>CA2007,IDE0073</NoWarn>
77
<UserSecretsId>8368baab-103b-45f6-bfb1-f89a537f4f3c</UserSecretsId>
@@ -10,7 +10,7 @@
1010
<ProjectReference Include="../../src/Tableau.Migration/Tableau.Migration.csproj" />
1111
</ItemGroup>
1212
<ItemGroup>
13-
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
13+
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.1" />
1414
</ItemGroup>
1515
<ItemGroup>
1616
<None Update="appsettings.Development.json">
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using System;
2+
3+
namespace Csharp.ExampleApplication.Hooks.InitializeMigration
4+
{
5+
#region class
6+
7+
public class CustomContext
8+
{
9+
public Guid CustomerId { get; set; }
10+
}
11+
12+
#endregion
13+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using System;
2+
using System.Threading;
3+
using System.Threading.Tasks;
4+
using Microsoft.Extensions.DependencyInjection;
5+
using Tableau.Migration.Engine.Hooks;
6+
7+
namespace Csharp.ExampleApplication.Hooks.InitializeMigration
8+
{
9+
#region class
10+
11+
internal class SetMigrationContextHook : IInitializeMigrationHook
12+
{
13+
public Task<IInitializeMigrationHookResult?> ExecuteAsync(IInitializeMigrationHookResult ctx, CancellationToken cancel)
14+
{
15+
var customContext = ctx.ScopedServices.GetRequiredService<CustomContext>();
16+
customContext.CustomerId = Guid.NewGuid();
17+
18+
return Task.FromResult<IInitializeMigrationHookResult?>(ctx);
19+
}
20+
}
21+
22+
#endregion
23+
}

examples/Csharp.ExampleApplication/MyMigrationApplication.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using Csharp.ExampleApplication.Config;
99
using Csharp.ExampleApplication.Hooks.BatchMigrationCompleted;
1010
using Csharp.ExampleApplication.Hooks.Filters;
11+
using Csharp.ExampleApplication.Hooks.InitializeMigration;
1112
using Csharp.ExampleApplication.Hooks.Mappings;
1213
using Csharp.ExampleApplication.Hooks.MigrationActionCompleted;
1314
using Csharp.ExampleApplication.Hooks.PostPublish;
@@ -147,6 +148,11 @@ public async Task StartAsync(CancellationToken cancel)
147148
_planBuilder.Transformers.Add<CustomViewExcludeDefaultUserTransformer, IPublishableCustomView>();
148149
#endregion
149150

151+
// Add initialize migration hooks
152+
#region SetCustomContext-Registration
153+
_planBuilder.Hooks.Add<SetMigrationContextHook>();
154+
#endregion
155+
150156
// Add migration action completed hooks
151157
#region LogMigrationActionsHook-Registration
152158
_planBuilder.Hooks.Add<LogMigrationActionsHook>();

examples/Csharp.ExampleApplication/Program.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using Csharp.ExampleApplication.Config;
33
using Csharp.ExampleApplication.Hooks.BatchMigrationCompleted;
44
using Csharp.ExampleApplication.Hooks.Filters;
5+
using Csharp.ExampleApplication.Hooks.InitializeMigration;
56
using Csharp.ExampleApplication.Hooks.Mappings;
67
using Csharp.ExampleApplication.Hooks.MigrationActionCompleted;
78
using Csharp.ExampleApplication.Hooks.PostPublish;
@@ -44,6 +45,14 @@ public static async Task Main(string[] args)
4445
/// <returns>The same service collection as the <paramref name="services"/> parameter.</returns>
4546
public static IServiceCollection AddCustomizations(this IServiceCollection services)
4647
{
48+
#region SetCustomContext-Service-DI
49+
services.AddScoped<CustomContext>();
50+
#endregion
51+
52+
#region SetCustomContext-Hook-DI
53+
services.AddScoped<SetMigrationContextHook>();
54+
#endregion
55+
4756
#region EmailDomainMapping-DI
4857
services.AddScoped<EmailDomainMapping>();
4958
#endregion

examples/DependencyInjection.ExampleApplication/DependencyInjection.ExampleApplication.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
5+
<TargetFrameworks>net8.0</TargetFrameworks>
66
<!-- Don't warn on ConfigureAwait on console application, Don't require license headers for sample code -->
77
<NoWarn>CA2007,IDE0073</NoWarn>
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
11+
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.1" />
1212
</ItemGroup>
1313

1414
<ItemGroup>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from tableau_migration import(
2+
InitializeMigrationHookBase,
3+
IInitailizeMigrationHookResult
4+
)
5+
6+
from Csharp.ExampleApplication.Hooks.InitializeMigration import CustomContext
7+
8+
class SetMigrationContextHook(InitializeMigrationHookBase):
9+
def execute(self, ctx: IInitailizeMigrationHookResult) -> IInitailizeMigrationHookResult:
10+
ctx.scoped_services._get_service(CustomContext)

examples/Python.ExampleApplication/Python.ExampleApplication.pyproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
<Compile Include="hooks\batch_migration_completed\log_migration_batches_hook.py" />
2626
<Compile Include="hooks\filters\default_project_filter.py" />
2727
<Compile Include="hooks\filters\unlicensed_user_filter.py" />
28+
<Compile Include="hooks\initialize_migration\set_custom_context_hook.py" />
2829
<Compile Include="hooks\mappings\change_project_mapping.py" />
2930
<Compile Include="hooks\mappings\email_domain_mapping.py" />
3031
<Compile Include="hooks\mappings\project_rename_mapping.py" />
@@ -60,6 +61,7 @@
6061
<Folder Include="hooks\mappings\" />
6162
<Folder Include="hooks\migration_action_completed\" />
6263
<Folder Include="hooks\batch_migration_completed\" />
64+
<Folder Include="hooks\initialize_migration\" />
6365
<Folder Include="hooks\post_publish\" />
6466
<Folder Include="hooks\transformers\" />
6567
</ItemGroup>

examples/Python.ExampleApplication/print_result.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
1-
from tableau_migration.migration import PyMigrationResult
2-
from tableau_migration import IMigrationManifestEntry, MigrationManifestEntryStatus
3-
from Tableau.Migration.Engine.Pipelines import ServerToCloudMigrationPipeline
1+
from tableau_migration import (
2+
IMigrationManifestEntry,
3+
MigrationManifestEntryStatus,
4+
MigrationResult,
5+
ServerToCloudMigrationPipeline
6+
)
47

5-
def print_result(result: PyMigrationResult):
8+
def print_result(result: MigrationResult):
69
"""Prints the result of a migration."""
710
print(f'Result: {result.status}')
811

9-
for pipeline_content_type in ServerToCloudMigrationPipeline.ContentTypes:
10-
content_type = pipeline_content_type.ContentType
12+
for pipeline_content_type in ServerToCloudMigrationPipeline.content_types():
13+
content_type = pipeline_content_type.content_type
1114

12-
type_entries = [IMigrationManifestEntry(x) for x in result.manifest.entries.ForContentType(content_type)]
15+
type_entries = [IMigrationManifestEntry(x) for x in result.manifest.entries.for_content_type(content_type)]
1316

1417
count_total = len(type_entries)
1518

0 commit comments

Comments
 (0)