We have a financial accounting software built on so called Tornado platform, which is in turn built on MS Visual Studio 2008. So please keep in mind our outdated version of Visual Studio. We can’t upgrade it. On Tornado platform, there is such thing as user report. These are custom made reports applicable where standard reports do not suffice. They are made usually by copying and modifying standard reports. The report solution is divided in three projects: client, interface and server. Custom reports are usually made by copying contents of each of these three projects into corresponding projects of custom report, and then modifying each .cs file replacing standard namespace (for example, Parus.Business.SalaryBudget) with custom namespace (for example, ParusPerm.ReportStatistical). Minor inconsistencies arising from it are usually easily mended by supplying namespace prefix to some identifiers and/or adding “using” directives. I did this conversion of standard report to user report a couple of times and had no problem.
This time I have a new problem, and I don’t know how to deal with it. All I did was copying several .cs files from standard interface project to custom interface project and changing namespace in the copied files from Parus.Business.SalaryBudget to ParusPerm.ReportStatistical. And now I get an error which is surprising me: «error CS0029: Cannot implicitly convert type 'ParusPerm.ReportStatistical.StatisticalReportingTypesEnum' to 'ParusPerm.ReportStatistical.StatisticalReportingTypes'
». The error is encountered in file ReportStatisticalAllSettings.cs in several lines of code like this:
ReportingType = StatisticalReportingTypesEnum.Culture;
Both types (on the left and on the right of the equal sign) are defined if file StatisticalReportingTypes.cs as follows:
public partial class StatisticalReportingTypes : Parus.Net.Server.Domains.EnumDomain<StatisticalReportingTypesEnum>, IEquatable<StatisticalReportingTypesEnum>
and
public enum StatisticalReportingTypesEnum
{Health, Culture, Science, Education, Socsecurity, Sport,}
I don’t see anything wrong in these definitions, and even if there were something wrong - then why it did not produce any error in the original standard report interface project? As I said, the only difference between standard project and custom project is the changed namespace in each .cs file. You can download my custom report solution here (without libraries): https://disk.yandex.ru/d/rLcj4GeoNI3S1g and with libraries here: https://disk.yandex.ru/d/UNGXxxXJtg3U8A
Can anyone please advise me why the error is there and how to avoid it?
Thank you, @Sweeper, you comment leads directly to the answer: there is an implicit conversion of those types. The implicit conversion is located near the end of StatisticalReportingTypes.cs and it looks like this:
public static implicit operator StatisticalReportingTypes(
Parus.Business.SalaryBudget.StatisticalReportingTypesEnum v)
{
return new StatisticalReportingTypes(v);
}
This is the place where the old namespace Parus.Business.SalaryBudget was hiding. So, to mend the situation, the old namespace should be erased, so that the code be:
public static implicit operator StatisticalReportingTypes(
StatisticalReportingTypesEnum v)
{
return new StatisticalReportingTypes(v);
}
This way the error was gone, thank you very much