एक परिदृश्य है जहां मुझे किसी इकाई से केवल एक/कुछ कॉलम चुनने की आवश्यकता है, लेकिन एक प्रश्न में कई बच्चे हैं। मैं अनुमानों के साथ प्रयास कर रहा हूं लेकिन संग्रह संपत्ति पर एक त्रुटि प्राप्त कर रहा हूं। यह एक सामान्य स्थिति है, फिर भी प्रोजेक्ट संग्रह पर जानकारी नहीं मिल सकती - केवल गुण।NHibernate अनुमान - संग्रह कैसे प्रोजेक्ट
Customer customerAlias = null;
Order orderAlias = null;
var list = _session.QueryOver<Customer>(() => customerAlias)
.JoinAlias(x => x.Orders,() => orderAlias, JoinType.LeftOuterJoin)
.Select(
Projections.Property(() => customerAlias.Name),
Projections.Property(() => customerAlias.Orders))//this is the issue
.List<object>();
त्रुटि दी है:
System.IndexOutOfRangeException : Index was outside the bounds of the array
के संभावित डुप्लिकेट [NHibernate QueryOver अनुमानों - डीटीओ को संग्रह पेश] (http://stackoverflow.com/questions/10535961/nhibernate-queryover-projections-projecting-collections-to-dto) – Baz1nga
दोहराना नहीं करते कृपया सवाल ... – Baz1nga
आपने दो गुणों का चयन किया है, शायद। लिस्ट