Beispiel #1
0
        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);
        }
Beispiel #2
0
        public void MigrateAgreementCustomSettings(Services.TpmContext cloudContext, Server.Agreement serverAgreement, Services.Agreement cloudAgreement)
        {
            Dictionary <string, string> dict = new Dictionary <string, string>();

            Server.CustomSettings serverCustomSettings = serverAgreement.GetCustomSettings();
            foreach (string key in serverCustomSettings.Keys)
            {
                dict[key] = serverCustomSettings[key];
            }

            Services.CustomSetting cloudCustomSetting = new Services.CustomSetting()
            {
                Name = cloudAgreement.Name
            };
            cloudCustomSetting.Blob = ByteArrayFormatter <Dictionary <string, string> > .Serialize(dict);

            cloudContext.AddToCustomSettings(cloudCustomSetting);
            cloudContext.RelateEntities(cloudCustomSetting, cloudAgreement, "Agreement", "CustomSettings", Services.RelationshipCardinality.ManyToOne);
        }