Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. LINQ
  4. how to convert a string with linq query content

how to convert a string with linq query content

Scheduled Pinned Locked Moved LINQ
csharpdatabaselinqhelptutorial
5 Posts 5 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    TataReddy_CTS
    wrote on last edited by
    #1

    Hi, I want to convert a “string” to its equivalent LINQ expression. Can someone pls help me with this? Like: String s= “from c in context.CpSoftwareResourceMaster select c”; to its equivalent linq expression. Its return type will be IQueriable<CpSoftwareResourceMasterEntity> actual here the string may even change dynamically. I mean at run time.. Ny Idea??

    ttr

    A P N G 4 Replies Last reply
    0
    • T TataReddy_CTS

      Hi, I want to convert a “string” to its equivalent LINQ expression. Can someone pls help me with this? Like: String s= “from c in context.CpSoftwareResourceMaster select c”; to its equivalent linq expression. Its return type will be IQueriable<CpSoftwareResourceMasterEntity> actual here the string may even change dynamically. I mean at run time.. Ny Idea??

      ttr

      A Offline
      A Offline
      Arun Jacob
      wrote on last edited by
      #2

      I think you are confused with the code.Your question is not clear. vat u mean by,

      Member 3532100 wrote:

      I want to convert a “string” to its equivalent LINQ expression.

      Arun Jacob http://codepronet.blogspot.com/

      1 Reply Last reply
      0
      • T TataReddy_CTS

        Hi, I want to convert a “string” to its equivalent LINQ expression. Can someone pls help me with this? Like: String s= “from c in context.CpSoftwareResourceMaster select c”; to its equivalent linq expression. Its return type will be IQueriable<CpSoftwareResourceMasterEntity> actual here the string may even change dynamically. I mean at run time.. Ny Idea??

        ttr

        P Offline
        P Offline
        Pete OHanlon
        wrote on last edited by
        #3

        This is more complicated than you may think. Basically, I think you are going to have to create dummy code that you compile at runtime (after injecting this string) and execute in a separate application domain. This isn't going to be pretty.

        "WPF has many lovers. It's a veritable porn star!" - Josh Smith

        As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

        My blog | My articles | MoXAML PowerToys | Onyx

        1 Reply Last reply
        0
        • T TataReddy_CTS

          Hi, I want to convert a “string” to its equivalent LINQ expression. Can someone pls help me with this? Like: String s= “from c in context.CpSoftwareResourceMaster select c”; to its equivalent linq expression. Its return type will be IQueriable<CpSoftwareResourceMasterEntity> actual here the string may even change dynamically. I mean at run time.. Ny Idea??

          ttr

          N Offline
          N Offline
          Not Active
          wrote on last edited by
          #4

          I'm not sure what your usage is for something like this but it seems to be in the same category as inline SQL statements, something that should not be used. If your intention is to allow users to form dynamic queries then I would question why you would give them access to the data model in such a manner and do they really need to know, or understand, the objects and how to write queries. If you are not exposing it to users, then why do this; you should know your model and not need to form dynamic queries. You can create a library queries to be executed later as needed.


          only two letters away from being an asset

          1 Reply Last reply
          0
          • T TataReddy_CTS

            Hi, I want to convert a “string” to its equivalent LINQ expression. Can someone pls help me with this? Like: String s= “from c in context.CpSoftwareResourceMaster select c”; to its equivalent linq expression. Its return type will be IQueriable<CpSoftwareResourceMasterEntity> actual here the string may even change dynamically. I mean at run time.. Ny Idea??

            ttr

            G Offline
            G Offline
            geali_dor
            wrote on last edited by
            #5

            I guess the only way to execute a dynamic linq-statement at all is to generate a dynamic code at runtime and use the statement as only dynamic part. for more information i found this page for example i've just googled for that hope this helps!

            hack the planet

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups