예제 #1
0
        private void FixSchemaReferences(BtsAssembly assembly)
        {
            foreach (BizTalkCore.Schema schema in assembly.Schemas)
            {
                //Schema s = this.Application.ParentInstallation.Schemas[schema.FullName] as Schema;
                Schema s = this.GetSchemaByFullyQualifiedName(schema, assembly.DisplayName);

                if (s != null)
                {
                    s.ParentAssembly = this.NameIdPair;
                    this.schemas.Add(s.NameIdPair);
                }
                else
                {
                    TraceManager.SmartTrace.TraceError("Could not locate schema. References will not be fixed.");
                }
            }
        }
예제 #2
0
        private void FixMapReferences(BtsAssembly assembly)
        {
            foreach (BizTalkCore.Transform transform in assembly.Transforms)
            {
                //Transform t = this.Application.ParentInstallation.Maps[transform.FullName] as Transform;
                Transform t = this.GetMapByFullyQualifiedName(transform.FullName, assembly.DisplayName);

                if (t != null)
                {
                    t.ParentAssembly = this.NameIdPair;
                    this.maps.Add(t.NameIdPair);
                }
                else
                {
                    TraceManager.SmartTrace.TraceError("Could not locate map. References will not be fixed.");
                }
            }
        }
예제 #3
0
        private void FixPipelineReferences(BtsAssembly assembly)
        {
            foreach (BizTalkCore.Pipeline pipeline in assembly.Pipelines)
            {
                //Pipeline p = this.Application.ParentInstallation.Pipelines[pipeline.FullName] as Pipeline;
                Pipeline p = this.GetPipelineByFullyQualifiedName(pipeline.FullName, assembly.DisplayName);

                if (p != null)
                {
                    p.ParentAssembly = this.NameIdPair;
                    this.pipelines.Add(p.NameIdPair);
                }
                else
                {
                    TraceManager.SmartTrace.TraceError("Could not locate pipeline. References will not be fixed.");
                }
            }
        }
예제 #4
0
        private void FixOrchReferences(BtsAssembly assembly)
        {
            foreach (BizTalkCore.BtsOrchestration orchestration in assembly.Orchestrations)
            {
                //Orchestration o = this.Application.ParentInstallation.Orchestrations[orchestration.FullName] as Orchestration;

                Orchestration o = this.GetOrchByFullyQualifiedName(orchestration.FullName, assembly.DisplayName);

                if (o != null)
                {
                    o.ParentAssembly = this.NameIdPair;
                    this.orchestrations.Add(o.NameIdPair);
                }
                else
                {
                    TraceManager.SmartTrace.TraceError("Could not locate Orch. References will not be fixed.");
                }
            }
        }
예제 #5
0
        static void Main(string[] args)
        {
            // Handle the command-line arguments and switches
            if (args.Length != 1)
            {
                PrintUsage();
                return;
            }
            if (("/?" == args[0]) || ("-?" == args[0]))
            {
                PrintUsage();
                return;
            }

            // Create the root object and set the connection string
            BtsCatalogExplorer catalog = new BtsCatalogExplorer();

            catalog.ConnectionString = string.Format("SERVER={0};DATABASE={1};Integrated Security=SSPI", SystemInformation.ComputerName, "BizTalkMgmtDB");

            try
            {
                // Get the requested assembly from the collaction
                BtsAssembly assembly = catalog.Assemblies[args[0]];
                if (null == assembly)
                {
                    Console.WriteLine("Assembly named " + args[0] + " was not found.");
                    return;
                }

                Console.WriteLine("Removing enlisted parties from assembly " + assembly.Name + ".");

                // Go through each Role in the assembly
                foreach (Role role in assembly.Roles)
                {
                    // Find the number of Parties enlisted
                    int numberOfEnlistedParties = role.EnlistedParties.Count;

                    // For each enlisted party, remove it
                    for (int count = 0; count < numberOfEnlistedParties; count++)
                    {
                        EnlistedParty enlistedParty = role.EnlistedParties[0];

                        Console.WriteLine("Unenlisting the " + enlistedParty.Party.Name + " Party from the " + enlistedParty.Role.Name + " Role.");

                        role.RemoveEnlistedParty(enlistedParty);
                    }
                }

                // commit the changes
                catalog.SaveChanges();

                Console.WriteLine("All enlisted parties for assemlby " + assembly.Name + " have been removed.");
            }
            catch (ConstraintException ce)
            {
                // Any changes need to be reverted
                // when there is an error
                catalog.DiscardChanges();

                // Since this is a common configruation excpetion
                // we don't need a stack trace
                Console.WriteLine(ce.Message);
            }
            catch (Exception e)
            {
                // Any changes need to be reverted
                // when there is an error
                catalog.DiscardChanges();

                Console.WriteLine(e.ToString());
            }
        }
예제 #6
0
 public static string Id(this BtsAssembly omAssembly)
 {
     return(omAssembly.DisplayName);
 }