Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save hoangitk/2e9fb9056bbf0c82ec0d to your computer and use it in GitHub Desktop.

Select an option

Save hoangitk/2e9fb9056bbf0c82ec0d to your computer and use it in GitHub Desktop.
public class EntitytMap:ClassMap<Entity>
{
public EntitytMap()
{
Table("TableName");
Schema(Session.TenantName);
Id(p => p.Id, "Id").GeneratedBy.Identity();
}
}
//If you want to have each tenant in their own schema, this should work. If you want to keep the schema the same but have a prefix on the table, you could change to:
public class EntityMap:ClassMap<Entity>
{
public EntityMap()
{
Table(Session.TenantPrefix + "TableName");
Schema("SCHEMA");
Id(p => p.Id, "Id").GeneratedBy.Identity();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment