forked from nicogis/RemoveClassExtension
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgeneric.cs
More file actions
40 lines (33 loc) · 1.29 KB
/
generic.cs
File metadata and controls
40 lines (33 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using ESRI.ArcGIS.Geodatabase;
namespace StudioAT.ArcGIS.ArcCatalog.AddIn.RemoveClassExtension.Generic
{
internal static class clsGenericStudioAT
{
public static bool RemoveClsExt(IClass classExtension)
{
ISchemaLock schemaLock = (ISchemaLock)classExtension;
bool result = false;
try
{
// Attempt to get an exclusive schema lock.
schemaLock.ChangeSchemaLock(esriSchemaLock.esriExclusiveSchemaLock);
// Cast the object class to the IClassSchemaEdit2 interface.
IClassSchemaEdit2 classSchemaEdit = (IClassSchemaEdit2)classExtension;
// Clear the class extension.
classSchemaEdit.AlterClassExtensionCLSID(null, null);
IObjectClassDescription featureClassDescription = new FeatureClassDescriptionClass();
classSchemaEdit.AlterInstanceCLSID(featureClassDescription.InstanceCLSID);
result = true;
}
catch
{
result = false;
}
finally
{
schemaLock.ChangeSchemaLock(esriSchemaLock.esriSharedSchemaLock);
}
return result;
}
}
}