Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 41743
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T15:13:45+00:00 2026-05-10T15:13:45+00:00

I have a LINQ to SQL generated class with a readonly property: <Column(Name:=totalLogins, Storage:=_TotalLogins,

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T15:13:45+00:00Added an answer on May 10, 2026 at 3:13 pm

    Set the existing TotalLogins property as either private or protected and remove the readonly attribute. You may also want to rename it e.g. InternalTotalLogins.

    Then create a new property by hand in the partial class that exposes it publically as a read-only property:

    Public ReadOnly Property TotalLogins() As System.Nullable(Of Integer)     Get         Return Me.InternalTotalLogins     End Get End Property 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a bunch of entity class (generated by Linq to SQL) with a
i have my auto-generated linq to sql classes, and i extend this class using
I have a LINQ to SQL class called Data with a column of type
What I have: LINQ to SQL auto generated class, which corresponds to the shape
I have two tables, with foreign key. linq to sql class generated for me
i have generated a Linq to Sql class which looks like this. so i
I have a BankAccount table. LINQ to SQL generates a class named BankAccount as
I have a LINQ to SQL class VoucherRecord based on a simple table. One
I have a Linq-To-Sql based repository class which I have been successfully using. I
I've got a LINQ 2 SQL generated class I'd like to expose through a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.