delphimvcframework/sources/MVCFramework.Serializer.Intf.pas
2017-02-09 19:34:12 +01:00

49 lines
1.6 KiB
ObjectPascal

unit MVCFramework.Serializer.Intf;
interface
uses
Data.DB, MVCFramework.DuckTyping, System.Rtti;
const
DMVC_CLASSNAME = '$dmvc_classname';
type
TMVCSerializationType = (Properties, Fields);
IMVCSerializerListener = interface
['{5976F9DA-1B89-4F8C-B333-C3612071DEE0}']
procedure BeforeSerialize(const AObject: TObject);
procedure AfterDeserialize(const AObject: TObject);
end;
IMVCSerializer = interface
['{1ECA942A-E3C4-45DD-9D23-C00363B5E334}']
function SerializeObject(AObject: TObject; AIgnoredProperties: array of string): String;
function SerializeObjectStrict(AObject: TObject): String;
function SerializeDataSet(ADataSet: TDataSet; AIgnoredFields: array of string): String;
function SerializeCollection(AList: TObject; AIgnoredProperties: array of string): String;
function SerializeCollectionStrict(AList: TObject): String;
procedure DeserializeObject(ASerializedObject: String; AObject: TObject);
procedure DeserializeObjectStrict(ASerializedObject: String; AObject: TObject);
procedure DeserializeCollection(ASerializedObjectList: string; AList: IMVCList; AClazz: TClass);
end;
IMVCTypeSerializer = interface
['{806EC547-D1CB-4DA9-92D3-A8A7C0BD4009}']
procedure SerializeInstance(
const ElementType: TRTTIType;
const ElementAttributes: TArray<TCustomAttribute>;
const InputValue: TValue;
out OutputObject: TObject);
procedure DeserializeInstance(
const ElementType: TRTTIType;
const ElementAttributes: TArray<TCustomAttribute>;
const InputObject: TObject;
out OutputValue: TValue);
end;
implementation
end.