我们不能直接去对对象进行修改,而是使用其复制版本.
server contexts 就像一个容器,可以存储创建的对象,如下面的代码:
Dim pPointCollection as IPointCollection = pServerContext.CreateObject("esriGeometry.Polygon") pServerContext.SetObject ("myPoly", pPointCollection) Dim pPoly as IPolygon = pServerContext.GetObject("myPoly")
Dim pServerContext As IServerContext = pSOM.CreateServerContext("", "") Dim pWSF As IWorkspaceFactory = pServerContext.CreateObject("esriDataSourcesGDB.AccessWorkspaceFactory") Dim pEnumSDI As IEnumServerDirectoryInfo = pSOM.GetServerDirectoryInfos Dim pSDI As IServerDirectoryInfo = pEnumSDI.Next Dim pProps As IPropertySet = pServerContext.CreateObject("esriSystem.PropertySet") ' this database will be cleaned by the GIS server pProps.SetProperty ("DATABASE", pSDI.Path &"\_ags_db1.mdb") pWSF.Create (pSDI.Path, "_ags_db1", pProps, 0) ' this database will not be cleaned by the GIS server pProps.SetProperty ("DATABASE", pSDI.Path &"\db2.mdb") pWSF.Create (pSDI.Path, "db2", pProps, 0) ' this database will not be cleaned by the GIS server pProps.SetProperty ("DATABASE", pSDI.Path &"\db2.mdb") pWSF.Create (pSDI.Path, "db2", pProps, 0)