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
  1. Home
  2. General Programming
  3. C#
  4. How to Use entity classes for Multiple Records ?

How to Use entity classes for Multiple Records ?

Scheduled Pinned Locked Moved C#
questiondatabasetutorialcareer
5 Posts 3 Posters 0 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.
  • N Offline
    N Offline
    Nishant Singh
    wrote on last edited by
    #1

    At present I am using Entity Classes for Storing Values Retrieved from DataBase . eg : I retrieved employeeName,employeeID and Salary from Database and assigned it to properties EntEmpname, EntEmpId,ENTSalary of entity class and using it on front end . Works fine for one record , My question is If I want to retrieve Multiple Records using Entity class do I have to create that many instances of Entity class or is there any other way out ?

    C 1 Reply Last reply
    0
    • N Nishant Singh

      At present I am using Entity Classes for Storing Values Retrieved from DataBase . eg : I retrieved employeeName,employeeID and Salary from Database and assigned it to properties EntEmpname, EntEmpId,ENTSalary of entity class and using it on front end . Works fine for one record , My question is If I want to retrieve Multiple Records using Entity class do I have to create that many instances of Entity class or is there any other way out ?

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Yes, you will, by definition, need a list of the Entity class. How else could it work ?

      Christian Graus Driven to the arms of OSX by Vista.

      N 1 Reply Last reply
      0
      • C Christian Graus

        Yes, you will, by definition, need a list of the Entity class. How else could it work ?

        Christian Graus Driven to the arms of OSX by Vista.

        N Offline
        N Offline
        Nishant Singh
        wrote on last edited by
        #3

        Hi Graus, So suppose my query returned me a 1000 records, will it be better to use a Dataset or still list of the Entity class would be better ??

        N 1 Reply Last reply
        0
        • N Nishant Singh

          Hi Graus, So suppose my query returned me a 1000 records, will it be better to use a Dataset or still list of the Entity class would be better ??

          N Offline
          N Offline
          N a v a n e e t h
          wrote on last edited by
          #4

          Nishant Singh wrote:

          will it be better to use a Dataset or still list of the Entity class would be better ??

          If you search this you will get plenty of discussions on this topic. IMO, you should go with custom strongly typed entity classes. Fill the entity classes with DataReader. Do you know a DataSet is filled using DataReader? Assume your entity class name is Customer, you can return 1000 records keeping in a List<Customer>. Since List(T) supports enumeration, it can be directly supplied to DataSource of all popular controls which supports data binding.

          Navaneeth How to use google | Ask smart questions

          N 1 Reply Last reply
          0
          • N N a v a n e e t h

            Nishant Singh wrote:

            will it be better to use a Dataset or still list of the Entity class would be better ??

            If you search this you will get plenty of discussions on this topic. IMO, you should go with custom strongly typed entity classes. Fill the entity classes with DataReader. Do you know a DataSet is filled using DataReader? Assume your entity class name is Customer, you can return 1000 records keeping in a List<Customer>. Since List(T) supports enumeration, it can be directly supplied to DataSource of all popular controls which supports data binding.

            Navaneeth How to use google | Ask smart questions

            N Offline
            N Offline
            Nishant Singh
            wrote on last edited by
            #5

            Thanx Navaneeth, Got your point ,

            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