示例#1
0
        public static VocabularyInfoCollection GetPublishedVocabularies()
        {
            Microsoft.BizTalk.RuleEngineExtensions.RuleSetDeploymentDriver dd = new Microsoft.BizTalk.RuleEngineExtensions.RuleSetDeploymentDriver();
            SqlRuleStore ruleStore = (SqlRuleStore)dd.GetRuleStore();

            return(ruleStore.GetVocabularies(RuleStore.Filter.Published));
        }
示例#2
0
        static void CleanUp(string RSName)
        {
            // Clean up deployed ruleset
            Microsoft.BizTalk.RuleEngineExtensions.RuleSetDeploymentDriver dd = new Microsoft.BizTalk.RuleEngineExtensions.RuleSetDeploymentDriver();
            RuleStore sqlrs;
            bool      bDeployed = false;

            sqlrs = dd.GetRuleStore();

            RuleSetInfoCollection rss = new RuleSetInfoCollection();

            rss = sqlrs.GetRuleSets(RSName, RuleStore.Filter.Latest);

            int i = 0;

            if (rss.Count > 0)
            {
                for (i = 0; i < rss.Count; i++)
                {
                    bDeployed = dd.IsRuleSetDeployed(rss[i]);
                    if (bDeployed)
                    {
                        dd.Undeploy(rss[i]);
                    }
                    sqlrs.Remove(rss[i]);
                }
            }
        }         // End of Cleanup()
示例#3
0
        private static void ExportPolicies()
        {
            // RuleSetDeploymentDriver has the following important methods
            Microsoft.BizTalk.RuleEngineExtensions.RuleSetDeploymentDriver dd = new Microsoft.BizTalk.RuleEngineExtensions.RuleSetDeploymentDriver();

            // SqlRuleStore - gives access t0 the rule engine database
            SqlRuleStore sqlRuleStore = (SqlRuleStore)dd.GetRuleStore();

            // Establish the export file
            FileRuleStore fileRuleStore = new FileRuleStore(policyExportPath);

            CopyPolicies(sqlRuleStore, fileRuleStore, dd);
        }
示例#4
0
        public static void ExportVocabularies()
        {
            // RuleSetDeploymentDriver has the following important methods
            Microsoft.BizTalk.RuleEngineExtensions.RuleSetDeploymentDriver dd = new Microsoft.BizTalk.RuleEngineExtensions.RuleSetDeploymentDriver();

            // SqlRuleStore - gives access t0 the rule engine database
            SqlRuleStore sqlRuleStore = (SqlRuleStore)dd.GetRuleStore();

            // Establish the export file
            FileRuleStore fileRuleStore = new FileRuleStore(vocabExportPath);

            CopyVocabularies(sqlRuleStore, fileRuleStore);
        }
示例#5
0
        public static int DeleteVocabulary(string name, int majorVersion, int minorVersion, out string message)
        {
            int result = 0;

            try
            {
                VocabularyInfo vInfo = new VocabularyInfo(name, majorVersion, minorVersion);
                Microsoft.BizTalk.RuleEngineExtensions.RuleSetDeploymentDriver rdd = new Microsoft.BizTalk.RuleEngineExtensions.RuleSetDeploymentDriver();
                SqlRuleStore ruleStore = (SqlRuleStore)rdd.GetRuleStore();
                ruleStore.Remove(vInfo);
                message = "Successfully Deleted";
            }
            catch (Exception exe)
            {
                message = exe.Message;
                return(-1);
            }

            return(result);
        }
示例#6
0
        public static int Import(string fileName, out string message)
        {
            int result = 0;

            try
            {
                Microsoft.BizTalk.RuleEngineExtensions.RuleSetDeploymentDriver dd = new Microsoft.BizTalk.RuleEngineExtensions.RuleSetDeploymentDriver();
                // SqlRuleStore - gives access t the rule engine database
                SqlRuleStore sqlRuleStore = (SqlRuleStore)dd.GetRuleStore();
                dd.ImportAndPublishFileRuleStore(fileName);
                message = "Successfully imported and published";
            }
            catch (Exception exe)
            {
                message = exe.Message;
                return(-1);
            }

            return(result);
        }
示例#7
0
        static void DeployRuleSet(RuleSet ruleset)
        {
            // Clean up the existing ruleset(s) in the rule store first
            // before publishing and deploying veriosn 1.0
            CleanUp(ruleset.Name);

            // now we have the ruleset, need to copy it to the database
            Microsoft.BizTalk.RuleEngineExtensions.RuleSetDeploymentDriver dd = new Microsoft.BizTalk.RuleEngineExtensions.RuleSetDeploymentDriver();
            RuleStore sqlrs;

            sqlrs = dd.GetRuleStore();
            // add the RuleSet to the database (and publish it)
            try
            {
                sqlrs.Add(ruleset, true);
            }
            catch (RuleStoreRuleSetAlreadyPublishedException)
            {
                Console.WriteLine("Warning: Ruleset \"" + ruleset.Name + "\" is already published");
            }
            catch
            {
                throw;
            }
            // now deploy the ruleset
            try
            {
                dd.Deploy(new RuleSetInfo(ruleset.Name,
                                          ruleset.CurrentVersion.MajorRevision, ruleset.CurrentVersion.MinorRevision));
            }
            catch (RuleEngineDeploymentAlreadyDeployedException)
            {
                Console.WriteLine("Warning: Ruleset \"" + ruleset.Name + "\" is already deployed");
            }
            catch
            {
                throw;
            }
        }
示例#8
0
        static void CleanUp()
        {
            // Clean up deployed ruleset
            Microsoft.BizTalk.RuleEngineExtensions.RuleSetDeploymentDriver dd = new Microsoft.BizTalk.RuleEngineExtensions.RuleSetDeploymentDriver();
            RuleStore sqlrs;
            bool      bDeployed = false;

            sqlrs = dd.GetRuleStore();

            RuleSetInfoCollection rss = new RuleSetInfoCollection();

            rss = sqlrs.GetRuleSets("SampleRuleset", RuleStore.Filter.All);

            int i = 0;

            if (rss.Count > 0)
            {
                for (i = 0; i < rss.Count; i++)
                {
                    bDeployed = dd.IsRuleSetDeployed(rss[i]);
                    if (bDeployed)
                    {
                        dd.Undeploy(rss[i]);
                    }
                    sqlrs.Remove(rss[i]);
                }
            }

            try
            {
                // Delete the SampleRuleStore.xml
                File.Delete("SampleRuleStore.xml");
            }
            catch
            {
                Console.Write("Cannot delete SampleRuleStore.xml as it is being edited currently. Please delete this file before you run the sample again.");
            }
        }
示例#9
0
        private static void ImportPolicies()
        {
            // RuleSetDeploymentDriver has the following important methods
            Microsoft.BizTalk.RuleEngineExtensions.RuleSetDeploymentDriver dd = new Microsoft.BizTalk.RuleEngineExtensions.RuleSetDeploymentDriver();

            // SqlRuleStore - gives access t0 the rule engine database
            SqlRuleStore sqlRuleStore = (SqlRuleStore)dd.GetRuleStore();

            // Establish the export file
            FileRuleStore fileRuleStore = new FileRuleStore(policyExportPath);

            CopyPolicies(fileRuleStore, sqlRuleStore, dd);
        }