Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

one-to-one fluent nhibernate?

Is it possible yet to do a one-to-one mapping with fluent nhibernate? I have the following as part of an hbm that I'm trying to convert to fluent:

    <one-to-one name="Person" property-ref="FileData" constrained="true"/>

I see a OneToOnePart<OTHER> in the code but i'm not sure how or if this is used to accomplish this.

Thanks!

like image 417
Chris Conway Avatar asked Feb 23 '09 21:02

Chris Conway


People also ask

What is the difference between NHibernate and fluent NHibernate?

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.

Is NHibernate an ORM?

NHibernate is a popular, fast growing ORM with a helpful community of seasoned developers. Used in thousands of commercial and open source projects.

What is NHibernate in .NET core?

NHibernate is the ORM, an object-relational platform that works on the ASP.Net core. Therefore, we can easily deploy the core project developed in ASP.NET that uses NHibernate on the Linux server without any effort. The application works in the same way as it will do on a windows platform.


1 Answers

There is a HasOne mapping

map => map.HasOne(x => x.Person)
     .PropertyRef(x => x.FileData)
     .Constrained();

I think that's what you're looking for.

like image 126
gcores Avatar answered Nov 15 '22 22:11

gcores