I'm investigating the behavior of Telerik Reporting DataSources because I have the need to implement a new complex DataSource that coordinates with another process providing data to Telerik in a lazy way.
For now, I want to study how Telerik talks to a specified DataSource by implementing a mock class that implements directly DataSource class.
class MockDataSource : DataSource
{
internal override object CreateClone()
{
throw new NotImplementedException();
}
}
I added CreateClone
method because the compiler shows me the following error:
Error CS0534 'MockDataSource' does not implement inherited abstract member 'DataSource.CreateClone()'
but even with the added method the above error doesn't disappear, and also the added method seems to override nothing:
Error CS0115 'MockDataSource.CreateClone()': no suitable method found to override
I'm pretty new to C#, but I can't figure out why this happens; also Telerik documentation doesn't state anywhere the feasibility of a custom DataSource which is not one of the provided: https://docs.telerik.com/reporting/connecting-to-data-data-source-components.
The reason of those errors resides in the visibility modifier of the abstact method CreateClone()
: inspecting library code decompiled from the DLL with the help of JetBrains Rider, it is possible to see that the method is declared as internal
:
[...]
namespace Telerik.Reporting
{
[SRCategory("DataSources_Category")]
[ToolboxItemFilter("VS.Telerik.Reporting.14.1.20.513", ToolboxItemFilterType.Require)]
public abstract class DataSource : Component, ISimpleDataSource, IDataSource, INamedObject, ICloneable
{
[...]
internal abstract object CreateClone();
[...]
}
}
Because of that, the method we need to override is not visible outside of Telerik's assembly, so it is not possible to actually extend the DataSource
abstract class from a third-party assembly.