プロパティを宣言しています - 開発環境で作業しているときは正常に動作しますが、ステージング環境にアクセスすると常に null が返されます。なぜこうなった?コードは両方の環境で変更されることはありません。これがコードです。
private ProductCollection _productCollection;
public ProductCollection ProdCollection
{
get
{
_productCollection = MWProductReviewHelper.GetDistinctProductFromTill(StoreId, TDPId, ReceiptId);
if (_productCollection.Count > 0)
return _productCollection;
else
return null;
}
}
private ProductCollection _guaranteedProductCollection = new ProductCollection();
public ProductCollection GuaranteedProductCollections
{
get
{
if (_guaranteedProductCollection.Count > 0)
{
return _guaranteedProductCollection;
}
else
{
return _guaranteedProductCollection = MWProductGuaranteedHelper.CheckGuaranteedProductsFromList(ProdCollection); // the problem appears to be here...
}
}
}
アクセスはこんな感じです。
if (GuaranteedProductCollections.Count > 0)
{
ProductCollection _prodCollection = GuaranteedProductCollections; // return null
}
その中には常に 1 つの製品があります。これは、ブレークポイントを設定するとわかります。