开发者

Help with attribute mapping my class

My class looks like:

public class User
{
      public virtual int ID {get;set;}
      public virtual string Use开发者_如何转开发rname {get;set;}

}

Table:

User
-UserID INT NOT NULL,
-Username NVARCHAR(50) NOT NULL

UserID is the PK, IDENTITY.

How would I use nhibernate attribute mapping for my class?


[Class(0, Name = "User", Table = "Users")]
public class User
{
      [Id(0, Name = ID", Type = "Int32", Column = "ID")]
      [Generator(1, Class = "native")]
      public virtual int ID {get;set;}
      [Property(0, Name = "Username", Column = "Username", Type = "string", NotNull = true , Length = 50)]
      public virtual string Username {get;set;}    
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜