How to do a fluent nhibernate one to one mapping?

前端 未结 4 859
长情又很酷
长情又很酷 2020-12-02 19:15

How do I do this I am trying to make a one to one mapping.

public class Setting
{
    public virtual Guid StudentId { get; set; }
    public virtual DateFilt         


        
4条回答
  •  南方客
    南方客 (楼主)
    2020-12-02 19:36

    First, define one of the sides of the relationship as Inverse(), otherwise there is a redundant column in the database and this may cause the problem.

    If this doesn't work, output the SQL statements generated by NHibernate (using ShowSql or through log4net) and try to understand why the foreign key constraint is violated (or post it here with the SQL, and don't forget the values of the bind variables that appear afer the SQL statement).

提交回复
热议问题