0

ModelBuilder 允许您声明实体之间的关系,但我们需要一种在运行时获取所有关系信息的方法。我们需要生成 JSON 来表达我们的 POCO 的关系。

relationships = {
            oneToOne: [{
                type: Person,
                hasKey: "id",
                hasOne: "ldapAccount",
                ofType: LdapAccount,
                withKey: "id",
                withForeignKey: "id",
                withOne: "person"
            }],
            oneToMany: [{
                type: Company,
                hasKey: "id",
                hasMany: "agencyRoles",
                ofType: AgencyRole,
                withKey: "id",
                withForeignKey: "companyId",
                withOne: "company"
            }],
            manyToMany: [{
                type: PermissionGroup,
                hasKey: "id",
                hasForeignKey: "permissionId",
                hasMany: "permissions",
                ofType: Permission,
                withKey: "id",
                withForeignKey: "permissionGroupId",
                withMany: "permissionGroups",
                usingMappingType: PermissionGroupToPermission
            }]
        };

有谁知道如何在运行时从上下文中检索关系信息?

4

0 回答 0