Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade TDataProxyFactory registration and usage #23

Closed
bogdanpolak opened this issue Aug 7, 2019 · 1 comment
Closed

Upgrade TDataProxyFactory registration and usage #23

bogdanpolak opened this issue Aug 7, 2019 · 1 comment
Labels
enhancement New feature or request

Comments

@bogdanpolak
Copy link
Owner

bogdanpolak commented Aug 7, 2019

New factory structure:

TDataProxyFactory = class
public
  class procedure RegisterDataSet(AProxyClass: TDataProxyClass; 
    const AConfigurationName: string; ADataSetCreateFun: TFun<TDataSet>); 
  class procedure SetDatasetConfiguration (AProxyClass: TDataProxyClass; 
    const AConfigurationName: string);
  class function CreateProxy (AProxyClass: TDataProxyClass; 
    AOwner: TComponent);
end;

Registration sample

TDataProxyFactory.RegisterDataSet(TBookProxy, 'FireDAC-dsBook', 
  function (): TDataSet;
  begin
    Result := TFDQuery.Create(AOwner);
    (Result as TFDQuery).Connection := FDConnection1;
    (Result as TFDQuery).SQL.Texr := 'SELECT ISBN, Title, Authors, ' +
      'Status, ReleseDate, Pages, Price, Currency, Imported, Description '+
      'FROM Books WHERE ReleaseDate > :ReleaseDate';
  end);
TDataProxyFactory.RegisterDataSet(TBookProxy, 'Mem-dsBook', CreateMockTableBook);

Configuration sample

TDataProxyFactory.SetDatasetConfiguration (TBookProxy, 'Mem-dsBook');

Usage sample

BookProxy := TDataProxyFactory.CreateProxy<TBookProxy>(AOwner)
BookProxy.Open ([EncodeDate(2018,01,01)],[ftDateTime])
@bogdanpolak bogdanpolak added the enhancement New feature or request label Aug 7, 2019
@bogdanpolak bogdanpolak added this to the version 0.6 milestone Aug 7, 2019
@bogdanpolak bogdanpolak added this to To do in ver0.6 Aug 7, 2019
@bogdanpolak bogdanpolak moved this from To do to In progress in ver0.6 Aug 9, 2019
@bogdanpolak bogdanpolak removed this from In progress in ver0.6 Aug 9, 2019
@bogdanpolak bogdanpolak removed this from the version 0.6 milestone Aug 9, 2019
@bogdanpolak
Copy link
Owner Author

Closed because of: Incorrect architectural assumptions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant