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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T19:23:13+00:00 2026-05-11T19:23:13+00:00

I am learning linq to sql and I am trying to setup a lookup

  • 0

I am learning linq to sql and I am trying to setup a lookup combo box in my web page. I was using a linq data source but I then moved my linqtosql code to it’s own class library for my DAL dll (took out of app_code folder). So, I am converting the page code to be able to still have lookups driven now by a biz object.

Here’s what I have done in my biz layer…

Public Class KosherTypes

    Public Shared Function GetKosherTypes() As List(Of KosherTypeLookup)
        Dim db As New DBDataContext

        Dim types = From kt In db.KosherTypes _
                    Where kt.IsDeleted = False _
                    Order By kt.Name _
                    Select New KosherTypeLookup With {.Name = kt.Name, .ID = kt.KosherTypeID}

        Return types.ToList

    End Function

End Class

I then setup an object data source and mapped it to this class.

I have a few questions as when I was doing internet searches I didn’t find anyone that seemed to be doing this and yet I know lookup tables / combo boxes are common…

  1. Did I totally just miss something and there are better way(s) to do this?

  2. I went with returning a list but I could have returned an IEnumerable or IQueryable. In my reading it seemed IQueryable had more functionality for linq to sql but since I am returning a simple two column list then I only need to return an IEnumerable or List. I went with a List since it’s strongly typed. Did I make a good decision? AKA – Should I just have returned and IEnumerable or perhaps gone with IQueryable?

Thanks!

  • 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-11T19:23:13+00:00Added an answer on May 11, 2026 at 7:23 pm

    I’ll answer in reverse order:

    1. I wouldn’t use IQueryable outside of your repos / DAL for the simple reason that since execution is deferred, you lose control of what exactly is executed (i.e., an aribtrary function could be assigned as a delegate for WHERE), making maintenance and testing much harder. I don’t see an issue with you returning an IEnumberable(Of KosherTypeLookup) though.
    2. If the lookup is a static lookup that never or rarely changes, you might want to look at a way to cache the lookup after the first use, to avoid having to hit the db every time that box is called. It really depends on your expected load, though. As always, performance/load testing will highlight where you need to optimize.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm considering spending time learning and using LINQ to SQL but after years of
I'm learning NHibernate to learn a more robust ORM than linq to sql, but
I'm learning Linq to SQL and I'm having trouble grasping it. I'm trying to
I'm learning Linq-to-Sql, and I'm encountering the scenario where I'm trying to build a
Using VS2008 and Sql CE 3.5, and preferably Linq to Sql. I'm learning database,
Just a basic question. Learning Linq to SQL and some nHibernate. I am using
I'm learning LINQ to SQL in LINQpad and it's been great, but there's a
I just started learning LINQ to SQL, and so far I'm impressed with the
I learning LINQ, and i want to use pending request, but i have this
I am trying to connect my application to a SQLite database with LINQ-to-SQL, and

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.