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

  • Home
  • SEARCH
  • 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 184499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T15:18:11+00:00 2026-05-11T15:18:11+00:00

I’m creating an abstract class that can be inherited in a partial class of

  • 0

I’m creating an abstract class that can be inherited in a partial class of a LINQ to SQL class. The LINQ to SQL class contains a bunch of built-in partial methods. Is there a way that I can implement one or more of the partial methods in the abstract class? I know that partial methods can only be contained within partial classes or structs. I’m sure there’s got to be another way to do it.

Here’s more detail:

  • I may have a database table called News. If I create a LINQ to SQL dbml file containing this table, the auto-generated code generates a partial class for News.
  • This partial class contains several partial methods.
  • I have a class that I’m building that contains several methods that I’d like to use across all my LINQ to SQL classes.
  • One of these methods is a partial method added to each LINQ to SQL class. I have a common body to use for this method. Rather than adding this method to each partial class, I’m looking for a way to create it once and inherit it with my base class inheritance.

Hope that helps explain more.

  • 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-11T15:18:12+00:00Added an answer on May 11, 2026 at 3:18 pm

    Partial methods are not usable over inheritance. You could add regular methods to the abstract base class, but they won’t automatically ‘pair’ with the partial method declarations. So: no. You can, of course, simply have the partial method implementation call into the base-class.

    Note also that if the common code relates to things like audit (who/when), you can also do this by overriding the DataContext‘s SubmitChanges method, and calling GetChangeSet:

        public override void SubmitChanges(ConflictMode failureMode)     {         ChangeSet delta = GetChangeSet();         //... use delta.Updates, delta.Inserts and delta.Deletes         base.SubmitChanges(failureMode);     } 

    Finally, note that you can also specify a common base-class for all your entities in the dbml (like so); you don’t have to do it by hand in each partial class.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
Does anyone know how can I replace this 2 symbol below from the string
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a French site that I want to parse, but am running into
Seemingly simple, but I cannot find anything relevant on the web. What is the
this is what i have right now Drawing an RSS feed into the php,
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti

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.