Basic conventions issue

6 views
Skip to first unread message

Valkenar

unread,
Feb 14, 2012, 1:29:04 PM2/14/12
to Fluent NHibernate
I'm trying to add/change the default foreign key convention for
mapping. Looking at the conventions page on wiki, I found this
snippet

Fluently.Configure()
.Database(/* database config */)
.Mappings(m =>
{
m.FluentMappings
.AddFromAssemblyOf<Entity>()
.Conventions.Add(PrimaryKey.Name.Is(x => "ID"));
})

But I get The name 'PrimaryKey' does not existin the current context.
I'm assuming that I'm missing the right using directive, but couldn't
figure out it was from either wiki or the api documentation.

What am I doing wrong?

Rasmoo

unread,
Feb 21, 2012, 5:11:46 AM2/21/12
to Fluent NHibernate
Basically, you may need these namespaces:
using FluentNHibernate.Conventions;
using FluentNHibernate.Conventions.Instances;
using FluentNHibernate.Conventions.Inspections;

The documentation of conventions is not that elaborate, but I have
some examples on various conventions to cover all foreign key names.
However, I had to resort to ugly kludges when the foreign key resides
in a component.

Let me know if you'd like examples of fk name conventions.

//Ras
Reply all
Reply to author
Forward
0 new messages