使用程序转换数据到udb碰到一个文件转换之后没有构件数据。
发现是因为其属性字段太多有将近一千个,addnew接口一直返回false。
写了一段测试代码,向有一千个属性字段的数据集中添加对象。
测试文件:链接:https://pan.baidu.com/s/1ARmQnge1YvT60-VqUZ6IMA 提取码:2333
测试代码:
var m_workspace = new Workspace();
DatasourceConnectionInfo dsinfo = new DatasourceConnectionInfo();
sinfo.Server = @"test.udb";
dsinfo.EngineType = EngineType.UDB;
dsinfo.Alias = "test";
Datasource m_ds = m_workspace.Datasources.Open(dsinfo);
DatasetVector m_dv = m_ds.Datasets["test"] as DatasetVector;
Recordset recordset = m_dv.GetRecordset(true, CursorType.Dynamic);
recordset.Batch.Begin();
GeoCylinder geoCylinder = new GeoCylinder();
geoCylinder.BottomRadius = 100;
geoCylinder.TopRadius = 100;
geoCylinder.Height = 200;
geoCylinder.Position = new Point3D(120, 29, 100);
Dictionary propertys = new Dictionary();
bool ret = recordset.AddNew(geoCylinder, propertys);
recordset.Batch.Update();
recordset.Dispose();
m_dv.ComputeBounds();
m_dv.Close();
m_ds.Close();