Skip to content

Commit c49de59

Browse files
authored
Merge pull request #15 from dotnetprog/feature/AjustReadMeForNewCommand
Readme adjusted + forgot a unit test
2 parents b763eb3 + 2eb3731 commit c49de59

File tree

2 files changed

+25
-7
lines changed

2 files changed

+25
-7
lines changed

README.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
![.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)
22
# Dataverse Configuration Migration Tool
33

4-
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.
4+
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.
55
### Download latest release
66
Get latest version of the tool built on this [release](https://github.com/dotnetprog/dataverse-configuration-migration-tool/releases/latest)
77
> [!NOTE]
@@ -19,19 +19,22 @@ This new tool enables you to:
1919
## ⭐Features⭐
2020

2121
:heavy_check_mark: Import configuration data into Dataverse \
22+
:heavy_check_mark: Export configuration data from Dataverse \
2223
:heavy_check_mark: Schema validation and rule-based checks \
2324
:heavy_check_mark: Support for special characters and self-hierarchy imports \
2425
:heavy_check_mark: Extensible for custom validation and reporting \
2526
:heavy_check_mark: Many to Many Relationships supported \
27+
: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. \
2628
:heavy_check_mark: Supports schemas and data files generated from :
2729
- [PowerPlatform CLI Export](https://learn.microsoft.com/en-us/power-platform/developer/cli/reference/data#pac-data-export)
2830
- [Configuration Migration tool](https://learn.microsoft.com/en-us/power-platform/admin/create-schema-export-configuration-data)
2931

32+
3033
❌Field types not supported:
3134
- MultiSelectOptionsets
3235
- Image
3336
- File
34-
- Owner ⚠️ Will eventually support it. No user mapping has been done currently
37+
3538

3639

3740

@@ -66,16 +69,20 @@ dotnet user-secrets set "Dataverse:Url" "<your-env-url>"
6669
```
6770

6871
Run the CLI tool with the required arguments (no need to pass clientId or clientSecret on the command line):
69-
72+
#### example
7073
```powershell
7174
dotnet run --environment DOTNET_ENVIRONMENT=Development --project Dataverse.ConfigurationMigrationTool.Console -- import --data "path/to/data.xml" --schema "path/to/schema.xml"
7275
```
7376

74-
#### 💻 Import Command Line Arguments 💻
77+
#### 💻 Command Line Arguments 💻
7578

7679
Verb: `import`
77-
- `--data` : Path to the data xml file
80+
- `--data` : Path to the data xml file, you can use `export-data` command or the microsoft tool (see last section).
81+
- `--schema` : Path to the schema XML file
82+
83+
Verb: `export-data`
7884
- `--schema` : Path to the schema XML file
85+
- `--output` : output file path to save the exported data. This file can be used for the `import` command.
7986

8087
## 🤝 Contributing 🤝
8188

@@ -104,7 +111,7 @@ You can use these workflows as a starting point for your own CI/CD automation. S
104111

105112
### </> Generating Schema and Data Files </>
106113

107-
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:
114+
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:
108115

109116
- [Create a schema and export configuration data](https://learn.microsoft.com/en-us/power-platform/admin/create-schema-export-configuration-data)
110117

src/Dataverse.ConfigurationMigrationTool/Console.Tests/Services/Filesystem/XmlFileDataReaderTests.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,17 @@ public async Task GivenAnXmlFile_WhenTheDataReaderReadsIt_ThenItShouldReturnData
1818
var entity = result.Entity.First();
1919
entity.Name.ShouldBe("fdn_insuranceproductnature");
2020
}
21-
21+
[Fact]
22+
public async Task GivenADataSchema_WhenTheDataServiceWritesIt_ThenItShouldSaveToAFile()
23+
{
24+
// Arrange
25+
var filePath = "assets/writeschema.xml";
26+
var dataSets = FakeDatasets.AccountSets;
27+
// Act
28+
await _xmlFileDataReader.WriteAsync(dataSets, filePath);
29+
// Assert
30+
var result = await _xmlFileDataReader.ReadAsync<EntityImport>(filePath);
31+
result.ShouldBeEquivalentTo(dataSets);
32+
}
2233

2334
}

0 commit comments

Comments
 (0)