Does anybody knows if there is the ability to check a layers datasource, if it is an direct connect to a database or if an ArcSDE service is used?
For both the esriDataSourcesGDB.SdeWorkspaceFactory
is used. Maybe there is a interface?
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.
Sign up to join this communityDoes anybody knows if there is the ability to check a layers datasource, if it is an direct connect to a database or if an ArcSDE service is used?
For both the esriDataSourcesGDB.SdeWorkspaceFactory
is used. Maybe there is a interface?
As Vince mentioned in his comment, you have to parse the connection properties.
A quick google search on: IsDirectConnect
and filetype:cs
https://www.google.com/webhp?sourceid=chrome-instant&ion=1&espv=2&es_th=1&ie=UTF-8#q=IsDirectConnect+filetype%3Acs&es_th=1 reveals an example that you can build on:
ftp://ftp.leesburgflorida.gov/gis/Telvent/Custom%20Code/Leesburg_10.1/Miner/Miner.ATeam/WorkspaceHelper.cs
public static bool IsDirectConnect(string instance)
{
return Regex.IsMatch(instance.ToString().ToLower(),
@"^sde:(oracle(8|9)i|sqlserver:\w+|db2)$",
RegexOptions.IgnoreCase
| RegexOptions.Singleline
| RegexOptions.CultureInvariant
| RegexOptions.IgnorePatternWhitespace);
}
Obviously, you would update this with current rdbms versions (and maybe add postgres if that's what you are using). It's a typical approach.