14

Delphi 2010 has new features regarding the RTTI, which I read it will make it easier for ORM tools and much cleaner code.

but I have not found any ORM incorporated these features.

Do you think the Embarcadero should built one and include it with Delphi

DelphiDev
  • 381
  • 1
  • 3
  • 11
  • I think currently it is not worthwhile for a vendor to exclusively target D2010 – Marco van de Voort May 31 '10 at 09:39
  • @Marco: Delphi 2010 introduced extended RTTI which is required to serialize / deserialize all object fields (including private and protected), and Attributes which are a very powerful way to add metadata to class definitions – mjn May 31 '10 at 10:14
  • I'm voting to close this question as off-topic because it's an open-ended opinion question. – Rob Kennedy Aug 17 '17 at 18:14
  • I initially voted to close this as opinion based but should we not leave it open because the community has obviously accepted it and provided very useful information? – Zia Aug 17 '17 at 20:02

6 Answers6

8

The Spring framework (which uses Delphi 2010 extended RTTI) has an Entity Framework on its roadmap:

http://code.google.com/p/delphi-spring-framework/

Delphi Spring Framework is an international open source project, whose mission is to provide a robust infrastructure framework that will help Delphi developers build solid, flexible and extensible enterprise applications and class libraries based on the Embarcadero® Delphi® 2010 for Win32 platform.

mjn
  • 36,362
  • 28
  • 176
  • 378
8

Another just-released Delphi 2010+ ORM is DORM. It does make use of the new RTTI features, and is able to persist any plain Delphi object.

Take perhaps a look at a Client-Server ORM like mORMot - which works fine with Delphi 2010 - the Client-Server dimension is worth mentioning in a SOA world.

Arnaud Bouchez
  • 42,305
  • 3
  • 71
  • 159
  • See http://blog.synopse.info/post/2012/07/12/One-ORM-to-rule-them-all for some points about mORMot in respect to other existing ORMs. – Arnaud Bouchez Jul 18 '12 at 06:58
4

DORM, The Delphi ORM is a new ORM OpenSource framework for Delphi usable from DelphiXE+ (it should work also on D2010, but it is not tested on that version). It supports (and use) all the new RTTI features. Allows file, attributes and Convention Over Configuration mapping. There are big production systems based on it. It will be integrated in Delphi Spring Framework since the next major release. It is developed by a small international community (6 people). http://code.google.com/p/delphi-orm/

To show some basic features, this is a unittest actually used.

procedure TTestDORM.TestCRUD;
var
  p1: TPerson;
  p1asstring: string;
  id: integer;
begin
  p1 := TPerson.NewPerson;
  try
    Session.Save(p1);
    p1asstring := p1.ToString;
    id := p1.id;
    Session.Commit;
  finally
    p1.Free;
  end;

  Session.StartTransaction;
  p1 := Session.Load<TPerson>(id);
  try
    CheckEquals(p1asstring, p1.ToString);
    Session.Commit;
  finally
    p1.Free;
  end;

  Session.StartTransaction;
  p1 := Session.Load<TPerson>(id);
  try
    p1.FirstName := 'Scott';
    p1.LastName := 'Summer';
    p1.Age := 45;
    p1.BornDate := EncodeDate(1965, 1, 1);
    Session.Update(p1);
    p1asstring := p1.ToString;
    Session.Commit;
  finally
    p1.Free;
  end;

  Session.StartTransaction;
  p1 := Session.Load<TPerson>(id);
  try
    CheckEquals(p1asstring, p1.ToString);
    Session.Delete(p1);
    Session.Commit;
  finally
    p1.Free;
  end;

  Session.StartTransaction;
  p1 := Session.Load<TPerson>(id);
  try
    CheckNull(p1);
    Session.Commit;
  finally
    p1.Free;
  end;
end;

P.S. I'm the main and principal author of DORM

Daniele Teti
  • 1,764
  • 14
  • 20
3

TMS Aurelius uses the new RTTI capabilities introduced in recent Delphi version. It also uses generics, operator overloading and other new Delphi features which makes it only compatible with Delphi 2010 and up.

menjaraz
  • 7,551
  • 4
  • 41
  • 81
1

What exactly features are you talking about?

There are several ORMs for Delphi: ORM for DELPHI win32

Community
  • 1
  • 1
Vladislav Rastrusny
  • 29,378
  • 23
  • 95
  • 156
  • 1
    None of those are exclusive to Delphi 2010's RTTI though. – Warren P May 31 '10 at 13:29
  • Why do you need *exclusive* ORMs? – Vladislav Rastrusny Jun 01 '10 at 16:04
  • 1
    how would an ORM look which supports Delphi 2 to 2010? It would use the least common denominator of the available language features. So better support only 2010+ and use extended RTTI and Attributes in the ORM API, like ORM for .Net and the Java platform do. – mjn Jun 02 '10 at 13:24
  • You are choosing ORM from the wrong side. First define some requirements you have for ORM and then search for the one, that provides all features you need. No matter if it works with all versions of Delphi from 2 to 2010. The most important thing is that it does everything you want. All other is irrelevant. – Vladislav Rastrusny Jun 02 '10 at 14:35
0

try use hcOPC(opensource project) in http://www.tpersistent.com/

MajidTaheri
  • 3,813
  • 6
  • 28
  • 46