用户
create table User (Id INT IDENTITY NOT NULL,
UserName NVARCHAR(255) null unique,
primary key (Id))
在SQLServer中为表用户命名是非法的,但命名是合法的
[用户]
.
create table [User] (Id INT IDENTITY NOT NULL,
UserName NVARCHAR(255) null unique,
primary key (Id))
[ActiveRecord("[User]")]
public class User : ActiveRecordLinqBase<User>
{
[PrimaryKey]
public int Id { get; set; }
[Property(Unique = true)]
public string UserName { get; set; }
[HasMany]
public IList<Activity> Activities { get; set; }
}
当使用
[
]
[ActiveRecord]
public class Activity : ActiveRecordLinqBase<Activity>
{
[PrimaryKey]
public int Id { get; set; }
[BelongsTo("[User]")]
public User User { get; set; }
}
当然,还有别的名字吗
[ActiveRecord("SomeUser")]
会有用的。