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.
Fluent NHibernate offers an alternative to NHibernate's standard XML mapping files. Rather than writing XML documents, you write mappings in strongly typed C# code. This allows for easy refactoring, improved readability and more concise code.
NHibernate is a popular, fast growing ORM with a helpful community of seasoned developers. Used in thousands of commercial and open source projects.
nhibernate Mappings Xml Mappings It is a syntax xml file which contains the metadata required for the object/relational mapping. The metadata includes declaration of persistent classes and the mapping of properties (to columns and foreign key relationships to other entities) to database tables.
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");
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With