Пример #1
0
 public static CEUtil GetInstance (string ceUri, string osName, string ceUser, string password, LogMsg logMsg)
 {
     // Singleton
     if (gCEUtil == null)
         gCEUtil = new CEUtil (ceUri, osName, ceUser, password, logMsg);
     return gCEUtil;
 }
Пример #2
0
        private CEUtil(string ceUri, string osName, string ceUser, string password, LogMsg logMsg)
        {
#if (P8_451)
            // P8 4.5 authentication
            UsernameToken token = new UsernameToken(ceUser, password, PasswordOption.SendPlainText);
            UserContext.SetProcessSecurityToken(token);
#else
            // P8 5.0 authentication
            UsernameCredentials cred = new UsernameCredentials(ceUser, password);
            ClientContext.SetProcessCredentials(cred);
#endif
            conn = Factory.Connection.GetConnection(ceUri);
            isCredentialsEstablished = true;

            // Get domain name
            PropertyFilter pf = new PropertyFilter();
            pf.AddIncludeProperty(0, null, null, "Name", null);
            pf.AddIncludeProperty(0, null, null, "Id", null);
            domain = Factory.Domain.FetchInstance(conn, null, null);
            objStore = Factory.ObjectStore.FetchInstance(domain, osName, null);

            // Successfully initialized CEUtil object: save singleton instance
            this.logMsg = logMsg;
            gCEUtil = this;
        }
Пример #3
0
 public void Close()
 {
     gCEUtil = null;
 }