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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T16:17:07+00:00 2026-05-12T16:17:07+00:00

Before LINQ I would have my main application return the results of a SQL

  • 0

Before LINQ I would have my main application return the results of a SQL query into a dataSet. I would then transfer the dataset as a parameter to the external dll. Now I am bringing through a LINQ to SQL query that is returned as an IQueryable(Of vClientTable) object. I want to be able to transfer that set of vClientTable results to my external dll in order for the dll to work with the data included in the results.

I am probably doing it all wrong as well as trying to do it all wrong, but would like some advice on what would be the best method to use.

DB Query

Public Shared Function getClientData(ByVal clientID As Int32) As IQueryable(Of vClientTable)
Try
    Dim r = From p In dbLINQ.vClientTable _
       Where p.ltClientID = clientID _
       Order By p.cdCode _
       Select p
    Return r
Catch ex As Exception
    Return Nothing
End Try
End Function

App Sub that retrieves the Data through the DB Query

Dim recordData As IQueryable(Of vClientTable) = getClientData(clientID)

Call to External DLL sub

dataComplete = outputClientData(Now, recordData)

DLL sub

public static Boolean outputClientData(DateTime rptDate, IQueryable<vClientData> clientData)
    {
        //Do something with the data
        return true;
    }

Obviously in the external dll it has no idea what an IQueryable(vClientData) object is and even if I create a dbml file and datacontext in my external project for the dll that includes the same class to the DB table/view it still says that the objects are different types.

Any ideas how I should be proceeding with this?

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-12T16:17:08+00:00Added an answer on May 12, 2026 at 4:17 pm

    Can the external dll reference the assembly with the entities in them? Then you can return any collection/set/whatever of your types. That is the simplest use.

    I would, however, tend to avoid exposing IQueryable<T> on the API, since it is very hard to guarantee full support for all operations, and hard to guarantee that the caller doesn’t break your DAL (accidentally or on purpose); I would have discreet operations that return known constructs such as List<T>, T[], etc.

    If you can’t add a reference, then other options include:

    • serialization (this is essentially how WCF transfers such objects; just enable serialziation on the designer surface, and use DataContractSerializer; you will need a matching data-contract at the other end, but it doesn’t have to be the same type)
    • transfer into a known type such as DataTable – a bit like this and this, although I’m not really a fan of DataTable
    • expose it as object, and use reflection (ho-hum)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

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.