Using nHibernate to Retrieve a Database Schema

Is it possible to create a database schema from nHibernate where I provided the nHibernate configuration to the database, but I did not write any mappings.

I want to get database metadata / schema programmatically.

I am using an Oracle database. I tried two approaches:

Approach one:

    public DatabaseMetadata GetMetadata(DbConnection connectionIn)
    {
        return new DatabaseMetadata(connectionIn, _dialect);
    }

Problem: It seems to me that this is really what I need, although it connects correctly, it does not pick up any of my tables. All I provided was an nHibernate configuration object that was populated with the contents of my nHibernate.xml.config file (connection string, driver client, etc.).

Question: Why not return table data to him? It is connected correctly, but finds nothing!

Approach to two:

 public void DatabaseSchema()
 {
     var schema = new SchemaExport(nHibernateConfiguration);
     schema.SetOutputFile("schema.dll");
      schema.Create(true, true);
 }

nHibernateConfiguration - ( ) nHibernate, nHibernate.xml.config.

: . :

NHibernate.MappingException:

, ? . , , , .

: , , ? , ?

, , , .

.

: , , .

+3
3

NHibernate . . , , .

:

: NHibernate . .

: SchemaExport SQL ( , ..) . , . *.sql, *.dll.

, , , , oracle ( , ). hilo (, , guid.comb ). , , , ?

:

, NHibernate . , , ( ). , , , .

+3

, , .

, NHibernate Mapping Generator . , . NHibernate Schema Tool .

- , , . "" . Fluent NHibernate ConfORM, , .

. , NHibernate. NHibernate , , , . , , , , .

+3

, , .

, NHibernate, , NHibernate, , , , , , :

NHibernate Automapper

ConfORM

.

- NHibernate, , .

Core NHibernate .

+1

Source: https://habr.com/ru/post/1759549/


All Articles