简体   繁体   English

ORM ODB for C ++可以从数据库生成代码

[英]Can ORM ODB for C++ generate code from a database

I am fairly new to this library, and ORM in general. 我对这个图书馆很新,一般都是ORM。 I know tools like EntityFramework can generate code from a database. 我知道像EntityFramework这样的工具可以从数据库生成代码。 Can ODB for C++ do this work? ODB for C ++能做到这一点吗?

I don't think so. 我不这么认为。 Looking at the main page of the project, there is an example how to use ODB. 查看项目的主页 ,有一个如何使用ODB的示例。 It seem that you need only add some pragmas here and there: 看来你只需要在这里和那里添加一些pragmas

#pragma db object
class person
{
  ...
private:
  friend class odb::access;
  person () {}

  #pragma db id
  string email_;

  string name_;
  unsigned short age_;
};

but you do that on already present code, so no, it does not generate anything. 但你在已经存在的代码上这样做,所以不,它不生成任何东西。

the QxORM maybe help you to this work. QxORM可能会帮助您完成这项工作。 this library use for Qt framework. 这个库用于Qt框架。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM