Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7850303
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T18:48:18+00:00 2026-06-02T18:48:18+00:00

I am using a Multitenant Application for various companies . I am yet to

  • 0

I am using a Multitenant Application for various companies . I am yet to get success with this . But what my scenario is I have a single sql server database with tablesets with different companies (tenants).

So what I want to do is add a convention for table which would access the table with its schema prefix in the table as per multitenant application concept . I am not using database per tenant but using schema per tenant . Database file is a single file .

What I want to do is my tables are like this Sachin Sales & Service Pvt Ltd$Web User Setup Header. so I want when the table queries would be generated they should add prefix Sachin Sales & Service Pvt Ltd on fly before querying . The prefix may change on requirement . Its not static . So I thought of overriding IClassConvention which by default looks like this

 public class TableNameConvention : IClassConvention
{
    public void Apply(IClassInstance instance)
    {
        instance.Table( instance.EntityType.Name);
    }
}

Is there anyway I can pass another parameter like string schemaname like this to generate the desired tablename with schema prefix ? My idea is to do something like this :

public class TableNameConvention : IClassConvention
{
    public void Apply(IClassInstance instance, string schemaname )
    {
        instance.Table(schemaname + instance.EntityType.Name);
    }
}

If so my questions are here like this . If i am able to achieve the point mentioned above will it solve my schema per tenant problem ?
And second even if the above doesnt give any errors while compiling (technically shouldnt) how am I supposed to pass schemaname into that override ? I mean how should I call since This is just a convention and I cannot manipulate it on fly (which I actually want to do)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T18:48:20+00:00Added an answer on June 2, 2026 at 6:48 pm

    you can set the schema use for all tables when configuring nhibernate, e.g.

    Fluently.Configure().Database(MsSqlConfiguration.MsSql2005.DefaultSchema(sometenantsSchema))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm building multi tenant application with shared table structure using Microsoft SQL Server. I
We are building an ASP.Net MVC 2 multi-tenant application on SQL Server using the
I have a multi-tenant application and I'm experimenting with using the i18n gem to
In a multi-tenant application I have a table with TenantId column. This table is
using file_get_contents , I open an Internet URL and get the contents of this
I'm working on a multi-tenant ASP.NET MVC application. So far we have been using
I have an application that is multitenant, that is, I have multiple clients that
I am using Grails multi-tenant plugin with single-tenant mode. I have used spring security
I'm looking at using Subsonic with a multi-tenant ASP.net web application. There are multiple
using (var file_stream = File.Create(users.xml)) { var serializer = new XmlSerializer(typeof(PasswordManager)); serializer.Serialize(file_stream, this); file_stream.Close();

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.