Pregunta

I find we can specify the "default-cascade" attribute of the element. But how can I do it in Fluent NHibernate? And I don't want to use AutoMapping.

¿Fue útil?

Solución

The detailed description could be found here: https://github.com/jagregory/fluent-nhibernate/wiki/Conventions. An extract:

There are some situations that are so obvious that they just cried out for a simple shortcut that can be applied globally to your project:

Table.Is(x => x.EntityType.Name + "Table")
...
DefaultCascade.All()
...

And this way we can use it:

Fluently.Configure()
  .Database(/* database config */)
  .Mappings(m =>
  {
    m.FluentMappings
      .AddFromAssemblyOf<Entity>()
      .Conventions.Add(DefaultCascade.All());
  })

Also check this, to get some idea how to implement own Conventions Fluent NHibernate automapping and cascading

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top