Esempio n. 1
0
        public static IWorkspace CreateGDB(string WStype, string name, string path)
        {
            IWorkspace        workspace        = null;
            Type              factoryType      = Type.GetTypeFromProgID(WStype);
            IWorkspaceFactory workspaceFactory = (IWorkspaceFactory)Activator.CreateInstance(factoryType);

            if (workspaceFactory.IsWorkspace(path + name))
            {
                workspace = workspaceFactory.OpenFromFile(path + name, 0);
            }
            else
            {
                IWorkspaceName workspaceName = workspaceFactory.Create(path, name, null, 0);
                IName          pName         = (IName)workspaceName;
                workspace = (IWorkspace)pName.Open();
            }
            return(workspace);
        }