Foreign keys with SchemaExport in Fluent NHibernate using SQLite

I am trying to create a simple database application that tracks loans of various types of equipment using Fluent NHibernate and SQLite. However, when I try to create a database structure using SchemaExportfor use in unit testing, foreign keys for one-to-many relationships are not created.

Here is my object Equipment:

public virtual int Id { get; set; }

public virtual EquipmentType Type { get; set; }

public virtual int StockId { get; set; }

And here are my comparisons for Equipment:

Id(x => x.Id);
References(x => x.Type);
Map(x => x.StockId);

SQL is generated correctly, except for the absence of foreign keys:

create table "Equipment" (
       Id integer,
       StockId INTEGER,
       Type_id INTEGER,
       primary key (Id)
    )

Is it possible to SchemaExportgenerate foreign keys when using a SQLite database?

Thank.

+5
1

.

SQLite (, 3.6.19), NHibernate SQLiteDialect .

SQLite ALTER TABLE, CREATE TABLE, NHibernate .

, NHJIRA https://nhibernate.jira.com/browse/NH-2200

+3

All Articles