here you have good explanations of both mapping nu code:
http://notherdev.blogspot.com/2012/02/nhibernates-mapping-by-code-summary.html?m=1

Vriendelijke groeten,
Van den Wouwer Danny

Software Engineer
Peopleware NV
www.peopleware.be

Op zo 20 sep. 2020 10:59 schreef Ezequiel De Luca <[email protected]
>:

> Hi:
>
> I am trying to create a unidirectional one-to-one relationship with fluent
> nhibernate as we are forced to migrate our solution from Java to C#. So far
> these are the Entities that I created to begin
>
> public class RequestEntity
> {
>     public virtual Guid ID { get; set; }
>     public virtual DateTime RequestDate { get; set; }
>     public virtual string BusinessJustification { get; set; }
>     public virtual UserEntity Reviewer { get; set; }
>     public virtual UserEntity Approver { get; set; }
>     public virtual DateTime ExpirationDate { get; set; }
> }
> public class UserEntity
> {
>     public virtual Guid Id { get; set; }
>     public virtual string DisplayName { get; set; }
>     public virtual string UserPrincipalName { get; set; }
> }
>
> and their respective mappings
>
> public RequestMap()
> {
>     Table("tbl_requests");
>     Id(x => x.ID);
>     Map(x => x.RequestDate);
>     Map(x => x.BusinessJustification);
>     Map(x => x.ExpirationDate);
>     References(x => x.Reviewer, "Reviewer").Unique();
>     References(x => x.PPEDD, "PPEDD").Unique();
> }
> public UserMap()
> {
>     Table("tbl_users");
>     Id(x => x.Id);
>     Map(x => x.DisplayName);
>     Map(x => x.UserPrincipalName);
> }
>
> I was able to perform a search on the database, but when the results are
> retrieved only the strId from the UserEntity is retrieved. In Java I make
> the following annotations:
>
> @OneToOne(cascade = CascadeType.ALL)
> @JoinColumn(name = "Reviewer", referencedColumnName = "Id")
>
> Do you know how I can get the same in C# and fluent-nhibernate?
>
> --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/nhusers/9d3e7e32-9165-40a5-afea-2c3e3277dba1n%40googlegroups.com
> <https://groups.google.com/d/msgid/nhusers/9d3e7e32-9165-40a5-afea-2c3e3277dba1n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nhusers/CAKQ81kvWg%3DooZQ%2BKWfiiUY%2BzJ9qewZSqkt1sQ-dzt1izLpXh0w%40mail.gmail.com.

Reply via email to