使用id属性的自定义类型

时间:2012-02-25 12:39:17

标签: nhibernate fluent-nhibernate

我得到了以下课程:

public class UserId
{
    public UserId(int id){
        //some validation
    }

   public override string ToString() {}
}

public class User
{
    public UserId Id {get;set;}
}

如何配置nhibernate / fluentnhibernate以使用该类。该列是一个int。

1 个答案:

答案 0 :(得分:5)

迭戈提到这不一定是个好主意

// UserMap
Id(m => m.Id).CustomType<UserIdUserType>();


class UserIdUserType : IUserType { ... }
相关问题