Esempio n. 1
0
 /// <summary>
 /// Sorts the resources based on their dependancies.
 /// They need to be sorted so when we generate a script to deploy the resources will
 /// be loaded to BizTalk in the correct order
 /// </summary>
 /// <param name="applicationDescription"></param>
 private static void SortResources(MetaDataBuildGenerator.ApplicationDescription applicationDescription)
 {
     ApplicationResourceSorter.Sort(applicationDescription.Resources);
     //applicationDescription.Resources.Sort();
     Trace.WriteLine("The resource order after Sort is:");
     foreach (MetaDataBuildGenerator.ApplicationResource r in applicationDescription.Resources)
     {
         Trace.WriteLine(r.FullName);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Describes the application
        /// </summary>
        /// <param name="applicationName"></param>
        /// <returns></returns>
        public static MetaDataBuildGenerator.ApplicationDescription DescribeApplication(string applicationName)
        {
            MetaDataBuildGenerator.ApplicationDescription applicationDescription = new MetaDataBuildGenerator.ApplicationDescription();

            using (Group group = new Group())
            {
                group.DBName   = BizTalkManagementDatabaseName;
                group.DBServer = BizTalkDatabaseServerName;
                Application app = group.Applications[applicationName];

                applicationDescription.Name        = app.Name;
                applicationDescription.Description = app.Description;

                //Add application references
                if (app.References != null)
                {
                    foreach (IApplication referencedApp in app.References)
                    {
                        applicationDescription.ReferencedApplications.Add(referencedApp.Name);
                    }
                }

                foreach (Resource resource in app.ResourceCollection)
                {
                    Debug.WriteLine("Resource Type: " + resource.ResourceType);
                    MetaDataBuildGenerator.ApplicationResource applicationResource = new MetaDataBuildGenerator.ApplicationResource();
                    applicationResource.FullName = resource.Luid;
                    applicationResource.Type     = GetResourceType(resource.ResourceType);

                    if (IncludeResource(applicationResource))
                    {
                        AddResourceReferences(resource, applicationResource);
                        AddResourceProperties(resource, applicationResource);
                        applicationDescription.Resources.Add(applicationResource);
                    }
                }

                AddDependantResources(applicationDescription);

                SortResources(applicationDescription);
            }
            return(applicationDescription);
        }
Esempio n. 3
0
 /// <summary>
 /// Looks at the references for each resource and creates links between resources based on the references.  This then allows the resources to be later sorted based on these dependancies
 /// </summary>
 /// <param name="applicationDescription"></param>
 private static void AddDependantResources(
     MetaDataBuildGenerator.ApplicationDescription applicationDescription)
 {
     foreach (MetaDataBuildGenerator.ApplicationResource resource in applicationDescription.Resources)
     {
         Trace.WriteLine("");
         Trace.WriteLine(resource.FullName);
         Trace.WriteLine("Depends on:");
         foreach (MetaDataBuildGenerator.ApplicationResource dependantResource in applicationDescription.Resources)
         {
             if (dependantResource.FullName != resource.FullName)
             {
                 if (resource.References.Contains(dependantResource.FullName))
                 {
                     Trace.WriteLine(dependantResource.FullName);
                     resource.DependantResources.Add(dependantResource);
                 }
             }
         }
     }
 }