diff --git a/README.md b/README.md index 4079b21..a84c89d 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ![.Net](https://img.shields.io/badge/.NET_8_SDK-5C2D91?style=for-the-badge&logoColor=white) [![Main Workflow](https://github.com/dotnetprog/dataverse-configuration-migration-tool/actions/workflows/main-pipeline.yml/badge.svg)](https://github.com/dotnetprog/dataverse-configuration-migration-tool/actions/workflows/main-pipeline.yml) ![badge](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/dotnetprog/aa1b559b3f614ea0719286f9e2972219/raw/code-coverage.json) # Dataverse Configuration Migration Tool -This repository contains a custom .NET CLI tool designed to import configuration data into Microsoft Dataverse environments. It streamlines the migration of configuration data, supports schema validation, and offers extensibility for advanced scenarios. +This repository contains a custom .NET CLI tool designed to export and import configuration data into Microsoft Dataverse environments. It streamlines the migration of configuration data, supports schema validation, and offers extensibility for advanced scenarios. ### Download latest release Get latest version of the tool built on this [release](https://github.com/dotnetprog/dataverse-configuration-migration-tool/releases/latest) > [!NOTE] @@ -19,19 +19,22 @@ This new tool enables you to: ## ⭐Features⭐ :heavy_check_mark: Import configuration data into Dataverse \ +:heavy_check_mark: Export configuration data from Dataverse \ :heavy_check_mark: Schema validation and rule-based checks \ :heavy_check_mark: Support for special characters and self-hierarchy imports \ :heavy_check_mark: Extensible for custom validation and reporting \ :heavy_check_mark: Many to Many Relationships supported \ +:heavy_check_mark: Owner,Team And Business Unit field is now supported. If by Unique Id is not found in target env, it matches by name otherwise it ignores the field. Caching is used to avoid unnecessary calls to dataverse. \ :heavy_check_mark: Supports schemas and data files generated from : - [PowerPlatform CLI Export](https://learn.microsoft.com/en-us/power-platform/developer/cli/reference/data#pac-data-export) - [Configuration Migration tool](https://learn.microsoft.com/en-us/power-platform/admin/create-schema-export-configuration-data) + ❌Field types not supported: - MultiSelectOptionsets - Image - File -- Owner ⚠️ Will eventually support it. No user mapping has been done currently + @@ -66,16 +69,20 @@ dotnet user-secrets set "Dataverse:Url" "" ``` Run the CLI tool with the required arguments (no need to pass clientId or clientSecret on the command line): - +#### example ```powershell dotnet run --environment DOTNET_ENVIRONMENT=Development --project Dataverse.ConfigurationMigrationTool.Console -- import --data "path/to/data.xml" --schema "path/to/schema.xml" ``` -#### 💻 Import Command Line Arguments 💻 +#### 💻 Command Line Arguments 💻 Verb: `import` -- `--data` : Path to the data xml file +- `--data` : Path to the data xml file, you can use `export-data` command or the microsoft tool (see last section). +- `--schema` : Path to the schema XML file + +Verb: `export-data` - `--schema` : Path to the schema XML file +- `--output` : output file path to save the exported data. This file can be used for the `import` command. ## 🤝 Contributing 🤝 @@ -104,7 +111,7 @@ You can use these workflows as a starting point for your own CI/CD automation. S ### Generating Schema and Data Files -To use the `import` command, you need a schema file and a data file. These can be generated from your Dataverse environment using the official Configuration Migration tool. For detailed instructions, refer to the Microsoft documentation: +To use the `import` or `export-data` command, you need a schema file and/or a data file. These can be generated from your Dataverse environment using the official Configuration Migration tool. For detailed instructions, refer to the Microsoft documentation: - [Create a schema and export configuration data](https://learn.microsoft.com/en-us/power-platform/admin/create-schema-export-configuration-data) diff --git a/src/Dataverse.ConfigurationMigrationTool/Console.Tests/Services/Filesystem/XmlFileDataReaderTests.cs b/src/Dataverse.ConfigurationMigrationTool/Console.Tests/Services/Filesystem/XmlFileDataReaderTests.cs index a5ec690..f9a9cac 100644 --- a/src/Dataverse.ConfigurationMigrationTool/Console.Tests/Services/Filesystem/XmlFileDataReaderTests.cs +++ b/src/Dataverse.ConfigurationMigrationTool/Console.Tests/Services/Filesystem/XmlFileDataReaderTests.cs @@ -18,6 +18,17 @@ public async Task GivenAnXmlFile_WhenTheDataReaderReadsIt_ThenItShouldReturnData var entity = result.Entity.First(); entity.Name.ShouldBe("fdn_insuranceproductnature"); } - + [Fact] + public async Task GivenADataSchema_WhenTheDataServiceWritesIt_ThenItShouldSaveToAFile() + { + // Arrange + var filePath = "assets/writeschema.xml"; + var dataSets = FakeDatasets.AccountSets; + // Act + await _xmlFileDataReader.WriteAsync(dataSets, filePath); + // Assert + var result = await _xmlFileDataReader.ReadAsync(filePath); + result.ShouldBeEquivalentTo(dataSets); + } }