2

有谁知道棉花糖(弹簧持久性)是否有现有的模型生成器。手动编写所有类和外键等并不是那么方便。

先感谢您。

type
  [Entity]
  [Table('Products')]
  TProduct = class
  private
    [Column('PRODID', [cpRequired, cpPrimaryKey, cpNotNull, cpDontInsert], 0, 0, 0, 'Primary Key')]
    [AutoGenerated]
    FId: Integer;
  private
    FName: string;
    FPrice: Currency;
    FQuantity: Integer;
    fCreationDate: TDate;
    fCreationDateTime: TDateTime;
    fCreationTime: TTime;
  public
    property ID: Integer read FId;
    [Column('PRODNAME', [], 50, 0, 0, 'Product name')]
    property Name: string read FName write FName;
    [Column('PRODPRICE', [], 0, 0, 0, 'Product price')]
    property Price: Currency read FPrice write FPrice;
    [Column('PRODQUANTITY')]
    property Quantity: Integer read FQuantity write FQuantity;
    [Column('PRODCREATIONDATE')]
    property CreationDate: TDate read fCreationDate write fCreationDate;
    [Column('PRODCREATIONDATETIME')]
    property CreationDateTime: TDateTime read fCreationDateTime write fCreationDateTime;
    [Column('PRODCREATIONTIME')]
    property CreationTime: TTime read fCreationTime write fCreationTime;
  end;

以便生成器为数据库中的表生成 pas 文件。

4

0 回答 0