GDB CreateRelationship gives Read Only error

452
0
01-11-2012 01:08 PM
MattPratap
New Contributor
I have a GDB with a table and a feature class in a many-to-many relationship, using a relationship class.

With ArcObjects 10.0.0 (using c#) I am using GetRow(OID) and GetFeature(OID) to get the two records to be linked, and then calling CreateRelationship(myFeatureClass, myRow) to create the relationship.

IRelationshipClass targetRelationshipClass = targetFeatureWorkspace.OpenRelationshipClass("myRelationshipClass");
IFeatureClass targetOriginFC = targetFeatureWorkspace.OpenFeatureClass(targetRelationshipClass.OriginClass.AliasName);
ITable targetDestinationTable = targetFeatureWorkspace.OpenTable(targetRelationshipClass.DestinationClass.AliasName);
while (...)
{
    //use lookup table to get the two oids to be linked.
    int oid1 = ...
    int oid2 = ...

    IFeature target_origin_row = targetOriginFC.GetFeature(oid1);
    IRow target_dest_row = targetDestinationTable.GetRow(oid2);
    targetRelationshipClass.CreateRelationship((IObject)target_origin_row, (IObject)target_dest_row);
}



However I am getting the following error:

Workspace or data source is read only. [The C:\Temp\myGdb.gdb workspace is read only.]


This only happens after about 1000-1200 calls to CreateRelationship.  If I force it to continue it will go for another 800-1000 more.

I am having difficulty finding any way to set the workspace in data "loading" mode or even use transactions, which I could do in 9.2 with the Java api, which solved many problems I had when doing bulk loading. 

Is there another wrapper or better way of using ArcObjects for .net when reading/writing to GDBs?

thanks
0 Kudos
0 Replies