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 6120209
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:38:33+00:00 2026-05-23T15:38:33+00:00

I have the following SQL table: ObjectTable ————————————————– | ID | Name | Order

  • 0

I have the following SQL table:

 ObjectTable
--------------------------------------------------
|  ID      |  Name         |  Order  |  ParentID  |
|  int PK  |  nvarchar(50) |  int    |  int FK    |     

ObjectTable.ParentID is a nullable field with a relationship to a different Object record’s ID. LINQ-to-SQL generates an class that looks like:

 public class DbObject{

      int ID { get; set; }

      string Name { get; set; }

      int Order { get; set; }

      int? ParentID { get; set; }

      DbObject Parent { get; set; }

      EntitySet<DbObject> ChildObjects { get; set; }

 }

When I load a DbObject instance, I need to be able to recursively access the child objects, so that I can write the data to a hierarchical JSON object.

  • Will I execute a separate query everytime I access the elements via DbObject.ChildObjects? Since DB transactions take the longest, it seems like this is a very inefficient way to load a recursive hierarchy.

  • What is the best practice for executing a recursive query with LINQ-to-SQL and/or EF?

  • Is LINQ-to-SQL integrated with Common Table Expressions?
    I found Common Table Expression (CTE) in linq-to-sql?

  • 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. Editorial Team
    Editorial Team
    2026-05-23T15:38:33+00:00Added an answer on May 23, 2026 at 3:38 pm

    in our case we have created stored procedures with CTE’s and put them on the l2s designer and they work like any other Table except they behave as a method rather than property and we have experienced no problem with that so far.

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

Sidebar

Related Questions

I have a SQL table: CREATE TABLE [UserTable] ( [ID] [int] NULL, [Name] [nvarchar](50)
I have a following SQL table with data ProductList id order productname 79 1
I have following table (SQL Server) Table name is LandParcels Blockid ParcelNo Stateorprivate ========================
I have the following pseudo-SQL schema: table flight id int primary key date timestamp
I have the following table: SQL> desc recording Name Null? Type -------------------- -------- ------
I have a sql table which have the following data, Id City Country ---
I have the following table and data in SQL Server 2005: create table LogEntries
I have the following SQL-statement: SELECT DISTINCT name FROM log WHERE NOT name =
I have a following SQL QUERY: SELECT articles.name, articles.price, users.zipcode FROM articles INNER JOIN
I have the following SQL table, Id WindSpeed DateTime -------------------------------------- 1 1.1 2009-09-14 16:11:38.383

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.