I have two or more units I need download from third party when your versions have changes.
I use xml databind to generate the units. They are something as:
unit tissV01;
interface
uses .....;
type
IXMLMensagemTISS = interface(IXMLNode)
['{11773827-F0A1-42E0-99E1-E221DFAF8542}']
{ Property Accessors }
end;
function GetmensagemTISS(Doc: IXMLDocument): IXMLMensagemTISS;
implementation
function GetmensagemTISS(Doc: IXMLDocument): IXMLMensagemTISS;
begin
Result := XXXX as IXMLMensagemTISS;
end;
end.
Unit tissV02
unit tissV02;
interface
uses .....;
type
{ IXMLMensagemTISS }
IXMLMensagemTISS = interface(IXMLNode)
['{11773827-F0A1-42E0-99E1-E221DFAF8542}']
{ Property Accessors }
property Cabecalho: string read Get_Cabecalho;
end;
function GetmensagemTISS(Doc: IXMLDocument): IXMLMensagemTISS;
implementation
function GetmensagemTISS(Doc: IXMLDocument): IXMLMensagemTISS;
begin
Result := XXXX as IXMLMensagemTISS;
end;
end.
In my app I need to have a choice what unit I have to use:
unit test;
interface
uses tissV01,tissV02, .......;
type
TMyform = class(TForm)
public
msg3:IXMLMensagemTISS;
end;
implementation
procedure TMyform.ExecuteMessage:
var
xmlTISS : TXmlDocument;
begin
xmlTISS := TXmlDocument.Create(nil);
if condition then
msg3 := tissV01.GetmensagemTISS(xmlTISS)
else msg3 := tissV02.GetmensagemTISS(xmlTISS);
with msg3.Cabecalho do something;
end;
end.
Logically, it doesn´t work because IXMLMensagemTISS is common to both units.
Is there some workaround to do it without I have to change the name of the Interface names(IXMLMensagemTISS)?
I´d like to simplify my code and I need maintain many units of this type in the future. The problem is that all implement IXMLMensagemTISS and I can do nothing to change it.
I´d not like to create many msg variables such as msgV01:=tissv01.GetmensagemTISS, msgV01:=tissv02.GetmensagemTISS, ... and so on