I'm not entirely sure if this is what your asking but if you need each class to map to the ClientId, here's one example.
Basically, each class would have a UserAccount property or whatever class is going to store the user's account information that has the ClientId property on it. Then in your Fluent NHibernate mapping, you can map the classes together using the References() method. See example below:
public class UserAccount
{
public virtual int Id { get; set; }
public virtual string Name { get; set; }
public virtual IList<Bill> Bills { get; set; }
}
public class Bill
{
public virtual int BillId { get; set; }
public virtual UserAccount User { get; set; }
}
public class UserAccount : ClassMap<UserAccount>
{
public UserAccount()
{
Id( x => x.Id ).Column( "ClientId" );
Map( x => x.Name );
HasMany( x => x.Bills );
}
}
public class BillMap : ClassMap<Bill>
{
public BillMap()
{
Id( x => x.Id ).Column( "BillId" );
References( x => x.User ).Column( "ClientId" );
}
}
So in your Bill table, you would have a ClientId column which in database terms is really a foreign key referencing the UserAccount table's primary key column which would also be named ClientId.
If you are truly going to have a large amount of tables that are all going to have a ClientId column, you also have the option of abstracting that out to a base class that your entities inherit from that would already have the UserAccount property on it. You could do the same base class approach for your Fluent NHibernate mapping files as well.