Is there any new ORM for Delphi 2010? [closed]

烂漫一生 提交于 2019-11-29 08:17:10

问题


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


回答1:


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.




回答2:


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.




回答3:


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




回答4:


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.




回答5:


What exactly features are you talking about?

There are several ORMs for Delphi: ORM for DELPHI win32




回答6:


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



来源:https://stackoverflow.com/questions/2942409/is-there-any-new-orm-for-delphi-2010

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!