سؤال

We are using Fluent NHibernate with automapping for our objects. Something like:

AutoPersistenceModel autoMap =
    AutoMap
    .Assemblies(mappingConfig, assembliesToMap.ToArray())
    .Conventions.AddFromAssemblyOf<BaseEntity>();   

I want to to add some indexes to some properties of my objects

I suspect that it can be done somewhere in the mappingConfig object, but I have no idea how this should be done!

Ideas anyone?

هل كانت مفيدة؟

المحلول

You may need to use overrides to do this:

http://wiki.fluentnhibernate.org/Auto_mapping#Altering_entities

.Override<Shelf>(map =>
{
  map.Map(x => x.SomeProperty)
     .Index("ix_myIndex");
});
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top