【发布时间】:2017-03-10 07:00:25
【问题描述】:
我有一个表,其中包含各种对象/实体的用户权限,如下所示:
object_type //an enum referring the the type of object that this record applies to
object_id //the id of the object
user_id
can_edit
etc.
这将与我项目中的其他几个表相关,这些表实际上没有任何共同点(照片就是一个例子)。要获得对象的权限,我希望能够执行以下操作:
//get the first photo along with all of the user permissions related to it
context.Set<Photos>()
.Include(p=>p.UserPermissions)
.FirstOrDefault(p=>p.Id == 1)
如果需要,我可以重组数据库,所以我想在这里提出您认为最好的解决方案。
【问题讨论】:
-
使用支持行安全性的数据库会智能大约 100 倍
标签: entity-framework database-design