Hi all,
I appreciate for the information you provided.
I looking for sample to create connection to Postgresql using FDO provider with MgResourceIdentifier
I already have method to make disconnect:
public void RemoveLayer(string layerName)
{
Document doc = Application.DocumentManager.MdiActiveDocument;
Editor ed = doc.Editor;
Database db = doc.Database;
AcMapMap map = AcMapMap.GetCurrentMap();
// remove the layer
var layers = map.GetLayers();
if (!layers.Contains(layerName))
{
ed.WriteMessage(
"\nLayer does not exist: " + layerName);
return;
}
MgLayerBase layer = layers.GetItem(layerName);
layers.Remove(layer);
// remove the layer resource
MgResourceIdentifier identifier = layer.LayerDefinition;
MgResourceService resourceService = AcMapServiceFactory.GetService(MgServiceType.ResourceService)
as MgResourceService;
if (resourceService.ResourceExists(identifier))
resourceService.DeleteResource(identifier);
// remove the feature source
identifier =
new MgResourceIdentifier(layer.FeatureSourceId);
if (resourceService.ResourceExists(identifier))
resourceService.DeleteResource(identifier);
}
Thank you in advance.
Michael