看看下面的DataBkr中的代码,就可以得到答案:
...
function TRemoteDataModule.GetProvider(const ProviderName: string): TCustomProvider;
var
i: Integer;
begin
Result := nil;
for i := 0 to FProviders.Count - 1do
if AnsiCompareText(TCustomProvider(FProviders).Name, ProviderName) = 0 then
begin
Result := TCustomProvider(FProviders);
if not Result.Exported then
Result := nil;
Exit;
end;
if not Assigned(Result) then
raise Exception.CreateResFmt(@SProviderNotExported, [ProviderName]);
end;
...
function TRemoteDataModule.AS_GetRecords(const ProviderName: WideString;
Count: Integer;
out RecsOut: Integer;
Options: Integer;
const CommandText: WideString;
var Params, OwnerData: OleVariant): OleVariant;
begin
Lock;
try
Result := Providers[ProviderName].GetRecords(Count, RecsOut, Options,
CommandText, Params, OwnerData);
finally
UnLock;
end;
end;
...
可见,客户端调用服务器接口时,是按照ProviderName在Providers中去找对应的DataSetProvider。
因此,一个RemoteDataModule中如果放较多的DataSetProvider,是会稍微影响点客户端的响应效率的。