jptechon
(jptechon)
May 11, 2022, 3:20pm
1
Hi,
I’ve codefirst DA server 's login class declare as
type
{ TLoginService }
[ROService('LoginService', '{99DA7AB4-FD41-40D5-85AD-7B5652ECEF8C}')]
[RONamespace('TemplServer')]
TLoginService = class(TSimpleLoginService)
In one the Function I need use the DALocalDataAdapter
function TLoginService.LoginChk: Boolean;
var
lda : TDALocalDataAdapter;
begin
lda := TDALocalDataAdapter.Create(Self);
lda.ServiceInstance := Self; << error
end;
I got Error
[dcc32 Error] LoginService_Impl.pas(159): E2010 Incompatible types: 'IDataAbstractLocalServiceAccess' and 'TLoginService'
Any Advise?
EvgenyK
(Evgeny Karpov)
May 12, 2022, 8:13am
2
Hi,
Only TDataAbstractService descendant can be used as service instance for TDALocalDataAdapter.
it was a security hole when Login service could be used as usual DataService.
workarounds:
specify usual DataService as the service instance
you can use Schema.NewDataset
like
var
lDataset: IDADataset;
lWhere: TDASQLWhereBuilder;
begin
try
lwhere := Connection.GetWhereBuilder;
try
lWhere.Expression := lWhere.NewBinaryExpressionList(
[lWhere.NewBinaryExpression('','Login',dboEqual,aUserID,datString),
lWhere.NewBinaryExpression('','Password',dboEqual,aPassword,datString)],
dboAnd);
lDataset := Schema.NewDataset(Connection, 'Users',[],lWhere.Xml);
finally
lWhere.Free;
end;
lDataset.Open;
jptechon
(jptechon)
May 12, 2022, 9:34am
3
I try to find the backup source and try to add localdatapter to this source ( delphi 10…3.3 and DA 10.0.1463) . After that convert to code first server, it can compile.
Is it newly changes on this?
However I will use your way to handle it , the above for your information.
Joe
EvgenyK
(Evgeny Karpov)
May 12, 2022, 10:08am
4
Hi,
it was changed in .1491 (~1.5 years ago)
check Data Abstract for Delphi vNext: New features or Breaking Changes for more details.