public void MigrateBusinessIdentities(Services.TpmContext cloudContext, Server.BusinessProfile serverBusinessProfile, Services.BusinessProfile cloudBusinessProfile) { foreach (Server.BusinessIdentity businessIdentity in serverBusinessProfile.GetBusinessIdentities()) { this.MigrateBusinessIdentity(cloudContext, (Server.QualifierIdentity)businessIdentity, cloudBusinessProfile); } }
public void MigrateBusinessProfile(Services.TpmContext cloudContext, Server.BusinessProfile serverBusinessProfile, Services.Partner cloudPartner) { Services.BusinessProfile cloudBusinessProfile = new Services.BusinessProfile() { Name = serverBusinessProfile.Name, Description = serverBusinessProfile.Description, Partner = cloudPartner }; cloudContext.AddToBusinessProfiles(cloudBusinessProfile); cloudContext.RelateEntities(cloudBusinessProfile, cloudPartner, "Partner", "BusinessProfiles", Services.RelationshipCardinality.ManyToOne); // Migrating the CustomSettings and business identities this.customSettingsMigrator.MigrateProfileCustomSettings(cloudContext, serverBusinessProfile, cloudBusinessProfile); this.businessIdentityMigrator.MigrateBusinessIdentities(cloudContext, serverBusinessProfile, cloudBusinessProfile); }
public void MigrateProfileCustomSettings(Services.TpmContext cloudContext, Server.BusinessProfile serverBusinessProfile, Services.BusinessProfile cloudBusinessProfile) { Dictionary <string, string> dict = new Dictionary <string, string>(); Server.CustomSettings serverCustomSettings = serverBusinessProfile.GetCustomSettings(); foreach (string key in serverCustomSettings.Keys) { dict[key] = serverCustomSettings[key]; } Services.CustomSetting cloudCustomSetting = new Services.CustomSetting() { Name = cloudBusinessProfile.Name }; cloudCustomSetting.Blob = ByteArrayFormatter <Dictionary <string, string> > .Serialize(dict); cloudContext.AddToCustomSettings(cloudCustomSetting); cloudContext.RelateEntities(cloudCustomSetting, cloudBusinessProfile, "BusinessProfile", "CustomSettings", Services.RelationshipCardinality.ManyToOne); }