mirror of
https://github.com/danieleteti/delphimvcframework.git
synced 2024-11-15 15:55:54 +01:00
808e3902d1
Better mobile support for RESTAdapter Better IFDEFing
50 lines
949 B
ObjectPascal
50 lines
949 B
ObjectPascal
unit Controllers.Base;
|
|
|
|
interface
|
|
|
|
uses
|
|
MVCFramework, MVCFramework.Commons, Services, MainDM;
|
|
|
|
type
|
|
TBaseController = class abstract(TMVCController)
|
|
strict private
|
|
FDM: TdmMain;
|
|
FArticlesService: TArticlesService;
|
|
function GetDataModule: TdmMain;
|
|
strict protected
|
|
function GetArticlesService: TArticlesService;
|
|
public
|
|
destructor Destroy; override;
|
|
|
|
end;
|
|
|
|
implementation
|
|
|
|
uses
|
|
System.SysUtils;
|
|
|
|
{ TBaseController }
|
|
|
|
destructor TBaseController.Destroy;
|
|
begin
|
|
FArticlesService.Free;
|
|
FDM.Free;
|
|
inherited;
|
|
end;
|
|
|
|
function TBaseController.GetArticlesService: TArticlesService;
|
|
begin
|
|
if not Assigned(FArticlesService) then
|
|
FArticlesService := TArticlesService.Create(GetDataModule);
|
|
Result := FArticlesService;
|
|
end;
|
|
|
|
function TBaseController.GetDataModule: TdmMain;
|
|
begin
|
|
if not Assigned(FDM) then
|
|
FDM := TdmMain.Create(nil);
|
|
Result := FDM;
|
|
end;
|
|
|
|
end.
|