private static void AddMapping(CrmDexExConfig crmDexExConfig, string solutionPath, Project project, WebResourceItem webResourceItem, Guid organizationId) { CrmDevExConfigOrgMap crmDevExConfigOrgMap = GetOrgMap(ref crmDexExConfig, organizationId, project.UniqueName); CrmDexExConfigWebResource crmDexExConfigWebResource = new CrmDexExConfigWebResource { WebResourceId = webResourceItem.WebResourceId, File = webResourceItem.BoundFile }; crmDevExConfigOrgMap.WebResources.Add(crmDexExConfigWebResource); ConfigFile.UpdateConfigFile(solutionPath, crmDexExConfig); }
public static void AddOrUpdateMapping(string solutionPath, Project project, WebResourceItem webResourceItem, Guid organizationId) { CrmDexExConfig crmDexExConfig = GetConfigFile(solutionPath, project.UniqueName, organizationId); CrmDevExConfigOrgMap crmDevExConfigOrgMap = GetOrgMap(ref crmDexExConfig, organizationId, project.UniqueName); List <CrmDexExConfigWebResource> crmDexExConfigWebResources = crmDevExConfigOrgMap.WebResources; if (crmDexExConfigWebResources == null) { crmDevExConfigOrgMap.WebResources = new List <CrmDexExConfigWebResource>(); } CrmDexExConfigWebResource crmDexExConfigWebResource = crmDevExConfigOrgMap.WebResources.FirstOrDefault(w => w.WebResourceId == webResourceItem.WebResourceId); if (crmDexExConfigWebResource == null) { AddMapping(crmDexExConfig, solutionPath, project, webResourceItem, organizationId); } else { UpdateMapping(crmDexExConfig, solutionPath, project, webResourceItem, organizationId); } }