<p>I have a LINQ to SQL generated class with a readonly property:</p>

<pre><code>&lt;Column(Name:="totalLogins", Storage:="_TotalLogins", DbType:="Int", UpdateCheck:=UpdateCheck.Never)&gt;  _
Public ReadOnly Property TotalLogins() As System.Nullable(Of Integer)
    Get
        Return Me._TotalLogins
    End Get
End Property
</code></pre>

<p>This prevents it from being changed externally, but I would like to update the property from within my class like below:</p>

<pre><code>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
</code></pre>

<p>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?</p>

```
```
Make a second property that is protected or internal(?) 

<Column(Name:="totalLogins", Storage:="_TotalLogins", DbType:="Int", UpdateCheck:=UpdateCheck.Never)>  _
protected Property TotalLogins2() As System.Nullable(Of Integer)
    Get
        Return Me._TotalLogins
    End Get
    Set(byval value as System.Nullable(Of Integer))
        Return Me._TotalLogins
    End Get
End Property
```
```
and then update that . I think it won't save readonly properties by default. And why should it anyway. I now it's a hack but hey that's life.