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. Database & SysAdmin
  3. Database
  4. Populating entity with optional properties

Populating entity with optional properties

Scheduled Pinned Locked Moved Database
helpsharepointdatabasesalesquestion
1 Posts 1 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.
  • B Offline
    B Offline
    bertvan
    wrote on last edited by
    #1

    Hello to all, I'm having kind of an issue with populating my entities. I have a Data Access for appointments. One time I will call a stored procedure returning me only the id, time and length of the appointment. Another time I will also receive the customer and the threatments of the appointment. (Sort of an agenda/customers overview for a Pet Barber..) I use a RunStoredProcedure method, to wich a pass the sp and the parameters. This method uses an SqlDataReader and returns a collection of appointments (in this case). In the method, to populate the entity, I use a PopulateEntity method, and that's where things go wrong. Since I'm not always populating the same number of properties, I sometimes call columns in the datareader that aren't there. Now, I could solve this, checking for a null value in the PopulateEntity method, but I'd rather have a more dynamic solution in wich I can pass the Properties to fill, and their respective column. Any nice way to do this? Can I pass object-properties by using attributes? Or am I on a wrong track here? Any help is welcome, tnx

    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