开发者

Using Fluent-NHibernate with tables in different database schemas

I have a database that I'm running several applications from. I like to separate the tables by creating a schema for each application. For my newest application I'm using FluentNHibernate. Seems like I have most of the plumbing correct but when I try to query one of my tables it can not find my table. I ran query analyzer and saw the schema was not included in the query.

I simply do not know what to put on my class (entity or mapper) so NHibernate knows which schema the class belongs to. Where and what do I place inside my classes to link them to a schema?

I've used Castle ActiveRecord in 开发者_如何学编程the past and it had an attribute property similar to this:

[ActiveRecord(schema=sports)]

Thanks for your help.


After reading more, the answer can be found on the Fluent NHibernate's FAQ portion of the website.

http://wiki.fluentnhibernate.org/Mapping_a_collection_that_uses_a_private_backing_field

public class PersonMap : ClassMap<Person>
{
  public PersonMap()
  {
    Schema("alternativeSchema");
  }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜