Mats
Mats

Reputation: 59

How to change schema with Fluent NHibernate AutoMapping

In my database every table belongs to a schema (Person for example.) I am using Fluent NHibernate with Automapping and my question is how I set the schema I want to use.

Upvotes: 1

Views: 674

Answers (2)

Marius
Marius

Reputation: 9654

public class SchemaConvention : IClassConvention
{
    public void Apply(IClassInstance instance)
    {
        instance.Schema("schemaNameGoesHere");
    }
}

Upvotes: 0

James Gregory
James Gregory

Reputation: 14223

Use a convention, specifically an IClassConvention.

Upvotes: 2

Related Questions