Closed prodehghan closed 1 year ago
Hello,
thank you for the issue report and the PR.
However just changing ITableHandle to IDataContainerHandle would introduce another issue. IDataContainerHandle is used in all cases where the handle could contain other data (for example in GetStructure, GetTable, GetString, and so on).
Could you please instead introduce another interface ITypeHandle and add it to GetTypeDescription and to IDataContainerHandle and ITableHandle?
Thanks, Frank
Hi,
Thanks for the follow up.
Maybe I'm not getting it, but I see some issues here.
There are two interfaces named IDataContainerHandle
:
Dbosoft.YaNco.IDataContainerHandle
Dbosoft.YaNco.Internal.FunctionHandle
(indirectly through IFunctionHandle
)Dbosoft.YaNco.Internal.StructureHandle
(indirectly through IStructureHandle
)Dbosoft.YaNco.Internal.TableHandle
(indirectly through ITableHandle
)IRfcRuntime
:
GetTypeDescription
, GetStructure
, GetTable
, GetString
, SetString
, ...DataContainer
class, and passed to respective IRfcRuntime
methodsDbosoft.YaNco.Internal.IDataContainerHandle
, which inherits from the other one and:
Dbosoft.YaNco.Internal.FunctionHandle
Dbosoft.YaNco.Internal.StructureHandle
Api
, which are equivalent to the ones we have in IRfcRuntime
.In RfcRuntime
class, the input parameter of many methods is the interface number 1, which when calling Api
method, is being cast (as
) to the interface number 2.
First of all, I see having these two separate interfaces problematic, causing unnecessary complications. Second, I see no reason for the second interface to not be implemented by TableHandle
, as these two interfaces are exactly being used in similar situations.
Sorry for the delay, but now I have looked into this problem. I added an experimental PR #264 to solve this problem by adding a new overload, but in the end I have to agree with your analysis. However, the real root problem here is that ITableHandle implements IDataContainer for simplification.
However, this makes no sense in terms of the semantic meaning of the data container, as it should only be used for fields that support reading and setting the underlying field values. However, your solution is the best option for solving the problem.
Again, thanks for your PR and your support. I will merge the PR.
fixes #260
Thanks for approving the PR. I agree with you that solving the underlying issue involves a lot more work, but to just fix the bug, this PR is fine.
This fixes
NullReferenceException
when callingDbosoft.YaNco.Table.GetTypeDescription()
method.