What is your code pattern? Like below:
MyDataSet.FieldByName(‘MYFIELD’).AsString := something…;
MyDataSet.Fields[n].AsString := something…;
Why can not used ORM(Object-relational mapping) code in Delphi?
Ex:
Employee.EmpNo := 1;
Employee.Name := 'Eden';
Because TDataSet! It's always only one mapping method: FieldByName. You are always only to use:
- IDE design mode, drop down TDataSet...
- Open TFields box, append all fields...
- Type innumerable "FieldByName" and "Fields" in Editor...
That is not your best solution, ever!
You need "Strong Type"! It is like String, Integer, Double etc!
So "Delphi ORM generator" application is born! as shown below:
|
Main page |
|
The demo is used MyBase |
How to connect?
“Delphi ORM generator” that uses ODBC, it can connection any database.
“With Table”
It can select multi items to build source unit in right memo. (Select only one Table in current version)
“With SQL” and “By MyBase”
It provides analysis SQL statement / MyBase data to build source unit (Only one table).
Why use “Delphi ORM generator”?
- Elegant: You can call Code Insight when editor, this fast input and code is clear!
- Correct: “Delphi ORM generator” out the code is hard-coded, so you can aware be wrong if typing a spelling errors in Design mode.
- Efficient: Besides quickly type, your program can increase the performance of more than 53.73%
Delphi ORM generator have 3 Field mode selector:
- TField
- T*Field
- Native Type
TField:
The mode is easy mapping about property to field, it's simple code like below:
type T: class (T)
Fid: TField;
public
property id: TField read Fid;
T*Field:
The mode is "Strong Field", like TStringField, TIntegerField, TFloatField etc. It's simple code like below:
type T: class (T)
Fid: TIntegerField;
public
property id: TIntegerField read Fid;
Use be like:
Emp: TEmpRow;
Emp.Id.Value := 1; // The Value is Integer type, it's Strong Type!
Native Type:
The mode is "Strong Type" and support "NULL" value, if field IS_NULLABLE is True in database table. It's simple code like below:
type T: class (T)
Fid: Integer; //Primary Key, IS_NULLABLE = False
FName: TNullableString; // IS_NULLABLE = True
public
property id: Integer read getId write setId;
property Name: TNullableString read getName write setName;
The mode, you could write code, like below:
var
LEmpRow: TEmpRow;
n: Integer;
n_str: string;
begin
...
LEmpRow := TEmpRow.Create(YourDataSet);
// Control original DataSet methods.
if LEmpRow.DataSet.Locate(EMP_ID, 100, []) then Break;
LEmpRow.DataSet.RecNo := n;
LEmpRow.DataSet.Append;
// Control row field method.
LEmpRow.Id := n; // Right
LEmpRow.Id := n_str; // Compiler Error: The property is Integer!
LEmpRow.Name := nil; // Can input nil!
if LEmpRow.Name.HasValue then // Output need check NULL
n_str := LEmpRow.Name.Value; // Get Value method.
...
You can download preview version:
7z Version!
or
Windows 10 Store: Delphi ORM Generator
Enjoy it!!!
====================================================
Delphi ORM Generator Windows Store App - 隱私權宣告
我們在何時收集什麼樣的信息?
當您使用應用程序時,我們並不會向您收集任何信息,如您的所在位置或IP資訊等。
我們為什麼要使用你的信息呢?
當您使用應用程序時,我們並不會向您收集任何信息,故並不會有出售、交換、轉移、或未經您的同意的行為。
我們如何保護您的信息?
當您進入或使用本軟體時,我們實行的各種保安措施,會維護您的個人信息安全。
我們使用cookies?
我們不使用cookies。
我們向外界透露任何信息嗎?
我們不會出售與交易或以其他方式轉讓您的個人身份信息。
您的同意
通過使用我們的應用程式,您同意我們應用程式的隱私政策。
我們的隱私政策的更改
如果我們決定改變我們的隱私政策,我們將在此頁面上更新這些變化。
聯繫我們
如果對本隱私政策有任何疑問,您可以使用文末的留言與我們連繫。