解决ArcEngine读取shp文件后,不关闭程序,文件锁不释放问题
用如下代码解决。FileGDB也是同理:
using ESRI.ArcGIS.DataSourcesFile;
using ESRI.ArcGIS.Geodatabase;
IWorkspaceFactory pwf =
new
ShapefileWorkspaceFactory();
//关闭资源锁定
IWorkspaceFactoryLockControl ipWsFactoryLock = IWorkspaceFactoryLockControl)pwf;
if
(ipWsFactoryLock.SchemaLockingEnabled)
{
ipWsFactoryLock.DisableSchemaLocking();
}