【发布时间】:2012-04-06 18:41:06
【问题描述】:
我有 2 个实体:
[TableName("is_userrole")]
public class UserRole
{
[MapField("id"), PrimaryKey, Identity,
public Guid id;
[NotNull]
public string Name;
}
[TableName("is_users")]
public class User
{
[MapField("id"), PrimaryKey, Identity,
NonUpdatable]
public Guid Id;
[NotNull]
public string Name;
[NotNull]
public string Login;
[NotNull]
public string Password;
public Guid UserRole_Id;
[Association(ThisKey = "UserRole_Id", OtherKey = "Id",
CanBeNull = false)]
public UserRole UserRole;
}
以及从查询中获取数据的sql server上的存储过程
[Select u., r. from is_users u 内连接 is_userrole r on u.userrole_id = r.id]
如果我使用像
这样的 linq 查询var query = 来自 db.User 中的 u 选择新的 { 身份证, u.登录, u.密码, u.UserRole_Id, u.UserRole };
关联填充,但如果我执行过程仅填充父对象(即用户)。
如何在 bltoolkit.net 中与存储过程建立关联?
还是只能手动实现?
谢谢。
【问题讨论】:
标签: associations bltoolkit proc