【发布时间】:2011-11-03 00:27:37
【问题描述】:
据我所知,要保存在数据库中的属性不能是只读的。 IIdentity 属性:AuthenticationType、IsAuthenticated 和 Name 都是只读的。
对需要保存的属性进行包装是唯一的解决方案还是有更好的解决方案?
编辑: 我可能没有很好地解释我的问题。这是其中一个 ReadOnly 属性的示例代码,我为实体框架添加了 UserName 属性:
Public Property UserName As String
Get
Return _userName
End Get
Private Set(value As String)
userName = value
End Set
Public ReadOnly Property Name As String Implements System.Security.Principal.IIdentity.Name
Get
Return UserName
End Get
End Property
我想问的是有没有更好的方法。
【问题讨论】:
标签: entity-framework