Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Can I create a Workspace without using IWorkspaceFactory.Create

I am trying to create a Workspace without specifying it's parent directory, is that possible ?

share|improve this question

Use a ScratchWorkspace. They are basically temporary local GeoDatabases that have full (single-user) GDB functionality. To create them, you don't need to specify anything. After you release the last reference, they get deleted.

share|improve this answer
Thanks for the reply, but Scratch Workspaces were designed to be created and used within a single session. If an application is started again at a later time, there is no reliable method for retrieving data that was previously stored in a ScratchWorkspace. – Seem Apr 2 '13 at 9:58
I guess if you do want it to be permanent, where do you want it to live (since wanting them to be permanent means that you want to access it again)? One option is to get the current user directory… and then generate a unique file name… . Append those two things and pass them to the IWorkspaceFactory.Create and you will have a permanent unique workspace – Ragi Yaser Burhum Apr 2 '13 at 17:56

I am not sure if it is possible not to use the .Create method, but i can giveyou an advice:

try to use the InMemoryWorkSpaceFactory:

/// <summary>
    /// Creates a workspace that resides in memory
    /// </summary>
    /// <returns>A feature workspace</returns>
    public static IFeatureWorkspace GetFeatureWorkspace()
        InMemoryWorkspaceFactory workspaceFactory = new InMemoryWorkspaceFactoryClass();
        IWorkspaceName workspaceName = workspaceFactory.Create(string.Empty, "Workspace", null, 0);

        IName name = (IName)workspaceName;
        IWorkspace inmemWor = (IWorkspace)name.Open();

        return (IFeatureWorkspace)inmemWor;

This kind of workspace does not require a path; but a withdraw is that has limited functionality in version 10 i.e: I was not able to update features created by a locator, in other hand in version 9.x it was possible.

share|improve this answer
Thanks a lot for you reply, as you can see InMemoryWorkSpaceFactory is used to create a temporary workspace that is stored in memory. So if I wanted to user the created Workspace again after releasing all of it's references, it will not be possible. – Seem Apr 2 '13 at 10:01

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.