I have a LINQ to SQL generated class with a readonly property:
<Column(Name:="totalLogins", Storage:="_TotalLogins", DbType:="Int", UpdateCheck:=UpdateCheck.Never)> _
Public ReadOnly Property TotalLogins() As System.Nullable(Of Integer)
Get
Return Me._TotalLogins
End Get
End Property
This prevents it from being changed externally, but I would like to update the property from within my class like below:
Partial Public Class User
...
Public Shared Sub Login(Username, Password)
ValidateCredentials(UserName, Password)
Dim dc As New MyDataContext()
Dim user As User = (from u in dc.Users select u where u.UserName = Username)).FirstOrDefault()
user._TotalLogins += 1
dc.SubmitChanges()
End Sub
...
End Class
But the call to user._TotalLogins += 1 is not being written to the database? Any thoughts on how to get LINQ to see my changes?