diff --git a/Capgemini.Xrm.Datamigration/Capgemini.Xrm.Datamigration.Examples/App.config b/Capgemini.Xrm.Datamigration/Capgemini.Xrm.Datamigration.Examples/App.config index 7fd9fc0..11063be 100644 --- a/Capgemini.Xrm.Datamigration/Capgemini.Xrm.Datamigration.Examples/App.config +++ b/Capgemini.Xrm.Datamigration/Capgemini.Xrm.Datamigration.Examples/App.config @@ -18,14 +18,17 @@ + + Contacts + Url = CRMUrl; Username=user; Password=password; AuthType=Office365; RequireNewInstance=True; Url = CRMUrl; Username=user; Password=password; AuthType=Office365; RequireNewInstance=True; - - Contacts + + False diff --git a/Capgemini.Xrm.Datamigration/Capgemini.Xrm.Datamigration.Examples/Program.cs b/Capgemini.Xrm.Datamigration/Capgemini.Xrm.Datamigration.Examples/Program.cs index 430bc3f..a801f28 100644 --- a/Capgemini.Xrm.Datamigration/Capgemini.Xrm.Datamigration.Examples/Program.cs +++ b/Capgemini.Xrm.Datamigration/Capgemini.Xrm.Datamigration.Examples/Program.cs @@ -52,14 +52,19 @@ static void ExportData(string connectionString, string schemaPath, string export var entityRepo = new EntityRepository(serviceClient, new ServiceRetryExecutor()); var logger = new ConsoleLogger(); - // Json Export - var fileExporterJson = new CrmFileDataExporter(logger, entityRepo, GetExportConfig(), tokenSource.Token); - fileExporterJson.MigrateData(); - - // Csv Export - var schema = CrmSchemaConfiguration.ReadFromFile(schemaPath); - var fileExporterCsv = new CrmFileDataExporterCsv(logger, entityRepo, GetExportConfig(), tokenSource.Token, schema); - fileExporterCsv.MigrateData(); + if (!Settings.Default.UseCsvImport) + { + // Json Export + var fileExporterJson = new CrmFileDataExporter(logger, entityRepo, GetExportConfig(), tokenSource.Token); + fileExporterJson.MigrateData(); + } + else + { + // Csv Export + var schema = CrmSchemaConfiguration.ReadFromFile(schemaPath); + var fileExporterCsv = new CrmFileDataExporterCsv(logger, entityRepo, GetExportConfig(), tokenSource.Token, schema); + fileExporterCsv.MigrateData(); + } Console.WriteLine("Export Finished"); } @@ -73,14 +78,19 @@ public static void ImportData(string connectionString, string schemaPath, string var entityRepo = new EntityRepository(serviceClient, new ServiceRetryExecutor()); var logger = new ConsoleLogger(); - // Json Import - var fileImporterJson = new CrmFileDataImporter(logger, entityRepo, GetImportConfig(), tokenSource.Token); - fileImporterJson.MigrateData(); - - //Csv Import - var schema = CrmSchemaConfiguration.ReadFromFile(schemaPath); - var fileImporterCsv = new CrmFileDataImporterCsv(logger, entityRepo, GetImportConfig(), schema, tokenSource.Token); - fileImporterCsv.MigrateData(); + if (!Settings.Default.UseCsvImport) + { + // Json Import + var fileImporterJson = new CrmFileDataImporter(logger, entityRepo, GetImportConfig(), tokenSource.Token); + fileImporterJson.MigrateData(); + } + else + { + //Csv Import + var schema = CrmSchemaConfiguration.ReadFromFile(schemaPath); + var fileImporterCsv = new CrmFileDataImporterCsv(logger, entityRepo, GetImportConfig(), schema, tokenSource.Token); + fileImporterCsv.MigrateData(); + } Console.WriteLine("Import Finished"); } diff --git a/Capgemini.Xrm.Datamigration/Capgemini.Xrm.Datamigration.Examples/Properties/Settings.Designer.cs b/Capgemini.Xrm.Datamigration/Capgemini.Xrm.Datamigration.Examples/Properties/Settings.Designer.cs index 3504793..dc2b9ac 100644 --- a/Capgemini.Xrm.Datamigration/Capgemini.Xrm.Datamigration.Examples/Properties/Settings.Designer.cs +++ b/Capgemini.Xrm.Datamigration/Capgemini.Xrm.Datamigration.Examples/Properties/Settings.Designer.cs @@ -25,8 +25,17 @@ public static Settings Default { [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("Url = https://sourcerepo.dynamics.com; Username=xxxx; Password=xxxx; AuthType=Off" + - "ice365; RequireNewInstance=True;")] + [global::System.Configuration.DefaultSettingValueAttribute("Contacts")] + public string DemoScenarioName { + get { + return ((string)(this["DemoScenarioName"])); + } + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("Url = CRMUrl; Username=user; Password=password; AuthType=Office365; RequireNewIns" + + "tance=True;")] public string CrmExportConnectionString { get { return ((string)(this["CrmExportConnectionString"])); @@ -35,8 +44,8 @@ public string CrmExportConnectionString { [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("Url = https://targetrepo.crm4.dynamics.com; Username=xxx; Password=xxxx; AuthType" + - "=Office365; RequireNewInstance=True;")] + [global::System.Configuration.DefaultSettingValueAttribute("Url = CRMUrl; Username=user; Password=password; AuthType=Office365; RequireNewIns" + + "tance=True;")] public string CrmImportConnectionString { get { return ((string)(this["CrmImportConnectionString"])); @@ -45,10 +54,10 @@ public string CrmImportConnectionString { [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("Contacts")] - public string DemoScenarioName { + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool UseCsvImport { get { - return ((string)(this["DemoScenarioName"])); + return ((bool)(this["UseCsvImport"])); } } } diff --git a/Capgemini.Xrm.Datamigration/Capgemini.Xrm.Datamigration.Examples/Properties/Settings.settings b/Capgemini.Xrm.Datamigration/Capgemini.Xrm.Datamigration.Examples/Properties/Settings.settings index 2d68b36..5370747 100644 --- a/Capgemini.Xrm.Datamigration/Capgemini.Xrm.Datamigration.Examples/Properties/Settings.settings +++ b/Capgemini.Xrm.Datamigration/Capgemini.Xrm.Datamigration.Examples/Properties/Settings.settings @@ -2,14 +2,17 @@ + + Contacts + - Url = https://sourcerepo.dynamics.com; Username=xxxx; Password=xxxx; AuthType=Office365; RequireNewInstance=True; + Url = CRMUrl; Username=user; Password=password; AuthType=Office365; RequireNewInstance=True; - Url = https://targetrepo.crm4.dynamics.com; Username=xxx; Password=xxxx; AuthType=Office365; RequireNewInstance=True; + Url = CRMUrl; Username=user; Password=password; AuthType=Office365; RequireNewInstance=True; - - Contacts + + False \ No newline at end of file