Skip to main content



Overriding EndPoints at Runtime

Prerequisites: A valid RuleSession
Namespaces: InRule.Runtime, InRule.Repository.EndPoints
Classes: RuleSession, DatabaseConnection, SendMailServerDef, WebServiceDef
See Also: Retrieving a Rule Application, Creating a RuleSession

Setting the database endpoint

// Override InvoiceDB connection string 
string connString = ConfigurationManager.ConnectionStrings["TestDb"];.ConnectionString;
ruleSession.Overrides.OverrideDatabaseConnection("InvoiceDB", connString);

Setting the WebService endpoint

// Override the web service address 
ruleSession.Overrides.OverrideWebServiceAddress("WebService1", "http://localhost/MyWebService/service1.svc?wsdl");

// Override the web service MaxReceivedMessageSize
ruleSession.Overrides.OverrideWebServiceMaxReceivedMessageSize("WebService1", Int32.MaxValue);

Setting the Mail server endpoint

//Override the smtp server from the .config file setting 
string server = ConfigurationManager.AppSettings["MailServer"];
ruleSession.Overrides.OverrideMailServerConnection("SmtpServer", server);