LokionNitrox

IWorkspace connection through WCF

Discussion created by LokionNitrox on Mar 16, 2011
Latest reply on Mar 21, 2011 by LokionNitrox
I have been working with a series of WPF controls within a custom add-in for ArcMap where the controls have a number of combo boxes that return the coded value domains for various features.  To return the coded values I am making a connection to SDE and pulling the values based on the String Name for the domain.  Visual Studio REALLY doesn't like to attempt to make that call out to SDE in the designer, which wrecks the entire solution, so I'm attempting to port that particular call to SDE over to a WCF service but I'm getting a COM exception (80040111) on the creation of my WorkspaceFactory (IWorkspaceFactory2).

        private IWorkspace OpenSDEWorkspace(String server, String instance, String database,
    String version, String user, String password)
        {
            try
            {
                String connectstring  = "SERVER=" + server
                    + ";DATABASE=" + database + ";INSTANCE=" + instance
                    + ";USER=" + user + ";PASSWORD=" + password + ";VERSION=" + version;

                IWorkspaceFactory2 sdeWorkspaceFactory;
                
                sdeWorkspaceFactory = (IWorkspaceFactory2)new SdeWorkspaceFactoryClass();
                IWorkspace workspace = (IWorkspace)sdeWorkspaceFactory.OpenFromString(connectstring,0);

                return workspace;
            }
            catch (Exception e)
            {
                throw new Exception(String.Format("arcSDEWorkspaceOpen: {0}", e.Message), e);
            }
        }


Any advice would be greatly appreciated.

Outcomes