To minimize the overhead I am asking an Oracle database table only for specific objects through the OpenTable method.
While it works with in the first attempt, all others fail. I do not know what the issue is but I am getting an ArcGIS.Core.Data.GeodatabaseQueryexception thrown when trying to open the table based on my query description.
Below is the code how I am trying to get the data. The exception thrown is pointing to "Geometry is null geometry" which is strange since I can find multiple objects that fulfil the SQL statement.
<SPAN class="keyword token">public</SPAN> <SPAN class="keyword token">async</SPAN> <SPAN class="keyword token">void</SPAN> <SPAN class="token function">SearchValidationTables</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">await</SPAN> QueuedTask<SPAN class="punctuation token">.</SPAN><SPAN class="token function">Run</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">=</SPAN><SPAN class="operator token">></SPAN>
<SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">using</SPAN> <SPAN class="punctuation token">(</SPAN>Database ValidationDatabase <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">Database</SPAN><SPAN class="punctuation token">(</SPAN>connectionFileValidation<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">{</SPAN>
<SPAN class="comment token">// get national string prefix</SPAN>
<SPAN class="keyword token">string</SPAN> nationalStringPrefix <SPAN class="operator token">=</SPAN> <SPAN class="string token">""</SPAN><SPAN class="punctuation token">;</SPAN>
SQLSyntax sqlSyntax <SPAN class="operator token">=</SPAN> ValidationDatabase<SPAN class="punctuation token">.</SPAN><SPAN class="token function">GetSQLSyntax</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
nationalStringPrefix <SPAN class="operator token">=</SPAN> sqlSyntax<SPAN class="punctuation token">.</SPAN><SPAN class="token function">GetSupportedStrings</SPAN><SPAN class="punctuation token">(</SPAN>SQLStringType<SPAN class="punctuation token">.</SPAN>NationalStringPrefix<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="token function">First</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="comment token">// build query here and set it into next line</SPAN>
<SPAN class="keyword token">string</SPAN> querySQL <SPAN class="operator token">=</SPAN> <SPAN class="string token">"SELECT * FROM SCHEMA.DBTABLE WHERE FEATURETYPE = "</SPAN><SPAN class="operator token">+</SPAN> nationalStringPrefix <SPAN class="operator token">+</SPAN><SPAN class="string token">"'waterways'"</SPAN><SPAN class="punctuation token">;</SPAN>
QueryDescription queryDescription <SPAN class="operator token">=</SPAN> ValidationDatabase<SPAN class="punctuation token">.</SPAN><SPAN class="token function">GetQueryDescription</SPAN><SPAN class="punctuation token">(</SPAN>querySQL<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"test"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="comment token">// set the column with a unique identifier</SPAN>
queryDescription<SPAN class="punctuation token">.</SPAN><SPAN class="token function">SetObjectIDFields</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"OBJECTID"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="comment token">// get data as featureclass and load it as featurelayer</SPAN>
<SPAN class="keyword token">try</SPAN>
<SPAN class="punctuation token">{</SPAN>
FeatureClass fcFromTable <SPAN class="operator token">=</SPAN> ValidationDatabase<SPAN class="punctuation token">.</SPAN><SPAN class="token function">OpenTable</SPAN><SPAN class="punctuation token">(</SPAN>queryDescription<SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">as</SPAN> FeatureClass<SPAN class="punctuation token">;</SPAN>
LayerFactory<SPAN class="punctuation token">.</SPAN>Instance<SPAN class="punctuation token">.</SPAN><SPAN class="token function">CreateFeatureLayer</SPAN><SPAN class="punctuation token">(</SPAN>fcFromTable<SPAN class="punctuation token">,</SPAN> MapView<SPAN class="punctuation token">.</SPAN>Active<SPAN class="punctuation token">.</SPAN>Map<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="keyword token">catch</SPAN> <SPAN class="punctuation token">(</SPAN><SPAN class="token class-name">GeodatabaseQueryException</SPAN> e<SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">throw</SPAN> e<SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>I found a bit more information by looking at the inner exception:

Does that mean I have to adjust the QueryLayerName?