Select to view content in your preferred language

Register As Versioned for c#

1509
1
06-14-2010 12:11 AM
myozaahmad
Emerging Contributor
I have two applications:

1. GIS Applications with ArcGIS Server version 9.3.1.
These applications are executed using ArcGIS Server Map Service, and with Oracle spatial database (SDE Geodatabase).

2. Desktop applications with ArcGIS Engine for .NET (C# language) version 9.3.

My case :
I want to do editing of spatial data (SDE Geodatabase) used by the application of GIS ( item no. 1).
I know to be able to do editing SDE Geodatabase, the dataset must be in "Register as Versioned". And to make dataset can be in "Register as Versioned", the Map Service of ArcGIS Server must be in stopped status. While ArcGIS Server Map Service always be on (starting) so that the GIS application (no. 1) keep it running well.

My Question :
As long as I know, On/Off of Map Service and setting Register as Versioned, do manually by ArcCatalog. I wish I
could do this job via my script program (see item no. 2). Could you share with me :

a. Script C# ArcGis Engine, to start, stop, and restart Map Service
b. Script C# ArcGis Engine, to setting Register As Versioned of SDE Geodatabase


With my best regards
myoza
0 Kudos
1 Reply
prabusankarsubramaniam
Emerging Contributor
To do Successful Register as version use the following method pass the dataset object to it.

public void processDStoSetVersioning(IDataset pDataset)
        {
           
            IVersionedObject pVersionedObj = null;
            try
            {
               if (pDataset != null)
                {
                    if (pDataset is IVersionedObject) { pVersionedObj = (IVersionedObject)pDataset; }
                    if (pVersionedObj != null)
                    {
                        if (pVersionedObj.IsRegisteredAsVersioned == true)
                        {
                               //Log for Already Registered Dataset
                         }
                        else
                        {
                            pVersionedObj.RegisterAsVersioned(true);
                             //Log for Successful Registration..
                        }
                    }
                  
                }

            }
            catch (Exception ex) { }
          
        }
0 Kudos