[fdo-users] Re: Insert KingOracle Provider

mdelsinne mdelsinne at gmail.com
Mon Nov 14 10:03:31 EST 2011


I still have the same problem, I tried everything but I can not find the
solution, yet well I get to connect and insert an entity via fdotoolbox but
using c # api, impossible, I still have the same message error: Unable to
find class definition! So here I block .

/IConnection conn = connectFDO("OSGeo.KingOracle.3.6");
IConnectionPropertyDictionary connProperties =
conn.ConnectionInfo.ConnectionProperties;
OSGeo.FDO.Connections.ConnectionState connState = conn.ConnectionState;

connProperties.SetProperty("Username", "FDO");
connProperties.SetProperty("Password", "FDO");
connProperties.SetProperty("Service", "BASETEST");
connProperties.SetProperty("OracleSchema", "FDO");
connProperties.SetProperty("KingFdoClass", "MYFDOCLASS");
connState = conn.Open();

IApplySchema cmdApplySchema =
conn.CreateCommand(OSGeo.FDO.Commands.CommandType.CommandType_ApplySchema)
as IApplySchema; 
FeatureSchema aFeatureSchema = new FeatureSchema("KingOra", "");
FeatureClass aFeatureClass = new FeatureClass("CLASSTEST", "");

// Add a id property
DataPropertyDefinition idProp = new DataPropertyDefinition("ID", "");
idProp.DataType = DataType.DataType_Int32;
idProp.IsAutoGenerated = true;
idProp.Nullable = false;
aFeatureClass.Properties.Add(idProp);
aFeatureClass.IdentityProperties.Add(idProp);

// Add a key property
DataPropertyDefinition keyProp = new DataPropertyDefinition("Key", "");
keyProp.DataType = DataType.DataType_String;
keyProp.Length = 255;
aFeatureClass.Properties.Add(keyProp);

// Add a name property
DataPropertyDefinition nameProp = new DataPropertyDefinition("Name", "");
nameProp.DataType = DataType.DataType_String;
nameProp.Length = 255;
aFeatureClass.Properties.Add(nameProp);

// Add a url property
DataPropertyDefinition urlProp = new DataPropertyDefinition("URL", "");
urlProp.DataType = DataType.DataType_String;
urlProp.Length = 255;
aFeatureClass.Properties.Add(urlProp);

// Add a geometry property
GeometricPropertyDefinition geomProp = new
GeometricPropertyDefinition("Geom", "");
geomProp.GeometryTypes = (int)GeometryType.GeometryType_MultiGeometry;
aFeatureClass.Properties.Add(geomProp);
aFeatureClass.GeometryProperty = geomProp;

aFeatureSchema.Classes.Add(aFeatureClass);

IApplySchema applySchema =
(IApplySchema)connect.CreateCommand(OSGeo.FDO.Commands.CommandType.CommandType_ApplySchema);
applySchema.FeatureSchema = schema;
applySchema.Execute();

IInsert cmdInsert =
conn.CreateCommand(OSGeo.FDO.Commands.CommandType.CommandType_Insert) as
IInsert;
cmdInsert.SetFeatureClassName(aFeatureClass.Name);
cmdInsert.PropertyValues.Clear();

// ID Value
Int32Value id = new Int32Value(idSdfObject);
cmdInsert.PropertyValues.Add(new PropertyValue("ID", id));
// Key Value
StringValue key = new StringValue(mySdfObject.Key.ToString());
cmdInsert.PropertyValues.Add(new PropertyValue("Key", key));
// Name Value
StringValue nameValue = new StringValue(mySdfObject.Name.ToString());
cmdInsert.PropertyValues.Add(new PropertyValue("Name", nameValue));
// URL Value
StringValue urlValue = new StringValue(mySdfObject.Url.ToString());
cmdInsert.PropertyValues.Add(new PropertyValue("URL", urlValue));
// Geometrie Value
GeometryValue geomValue = new GeometryValue(getGeom(mySdfObject, sdf2File));
cmdInsert.PropertyValues.Add(new PropertyValue("Geom", geomValue));

IReader cmdRead = cmdInsert.Execute();
cmdRead.Close();
/
*Unable to find class definition!*

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Insert-KingOracle-Provider-tp6992058p6992775.html
Sent from the FDO Users mailing list archive at Nabble.com.


More information about the fdo-users mailing list