Eager Loading Problem
-
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
-
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
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
-
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
As usual, you are correct. Forgot to include the StreetSuffix in the Get. Cheers, --EA