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. Eager Loading Problem

Eager Loading Problem

Scheduled Pinned Locked Moved C#
questionperformancehelptutorial
3 Posts 2 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.
  • E Offline
    E Offline
    eddieangel
    wrote on last edited by
    #1

    I disabled Lazy Loading for various reasons (Mostly proxy craziness and performance) but I have hit a snag I don't know how to handle. I have an address table that has a street address broken into parts. One of the pieces is a SuffixId that determines if it is a street, ave, etc... Here is my fullAddress property of the address:

    public string fullAddress
    {
    get
    {
    string address = number.ToString();
    if (direction != null)
    address += " " + direction;
    address += " " + street;
    if (suffixId != null)
    address += " " + StreetSuffix.abbreviation;
    return address;
    }
    }

    Now my problem is with the StreetSuffix.abbreviation part, I am getting a null reference. How do I handle this? Cheers, --EA

    M 1 Reply Last reply
    0
    • E eddieangel

      I disabled Lazy Loading for various reasons (Mostly proxy craziness and performance) but I have hit a snag I don't know how to handle. I have an address table that has a street address broken into parts. One of the pieces is a SuffixId that determines if it is a street, ave, etc... Here is my fullAddress property of the address:

      public string fullAddress
      {
      get
      {
      string address = number.ToString();
      if (direction != null)
      address += " " + direction;
      address += " " + street;
      if (suffixId != null)
      address += " " + StreetSuffix.abbreviation;
      return address;
      }
      }

      Now my problem is with the StreetSuffix.abbreviation part, I am getting a null reference. How do I handle this? Cheers, --EA

      M Offline
      M Offline
      Mycroft Holmes
      wrote on last edited by
      #2

      Why are number, direction and street also notnull. Because you load the information somewhere. I suspect you are not loading the StreetPrefix record.

      Never underestimate the power of human stupidity RAH

      E 1 Reply Last reply
      0
      • M Mycroft Holmes

        Why are number, direction and street also notnull. Because you load the information somewhere. I suspect you are not loading the StreetPrefix record.

        Never underestimate the power of human stupidity RAH

        E Offline
        E Offline
        eddieangel
        wrote on last edited by
        #3

        As usual, you are correct. Forgot to include the StreetSuffix in the Get. Cheers, --EA

        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