Hi Matt,
I'm using llb 2.6. Updating is always my first attempt at fixing and I am using Feb 6th build which still seems to be the latest available. Tha'ts the Feb 6th designer and runtime.
Heres the full stack trace:
[InvalidCastException: Unable to cast object of type 'Shivam.Horsell.Quotation.DAL.EntityClasses.CustomerQuotationEntity' to type 'Shivam.Horsell.Quotation.DAL.EntityClasses.MyCustomerQuotationEntity'.]
Shivam.Horsell.Quotation.DAL.EntityClasses.MyProductDetailEntity.get_CustomerQuotationUsingCustomerQuotationId() in D:\Projects\Horsell.Quotation\Horsell.Quotation\Shivam.Horsell.Quotation.DAL\EntitySubClasses\MyProductDetailEntity.cs:210
Shivam.Horsell.Quotation.BL.Rater.RatingFigureCalculator.get_AdminFee() in D:\Projects\Horsell.Quotation\Horsell.Quotation\Shivam.Horsell.Quotation.BL\Rater\RestaurantRatingEngine.cs:465
Shivam.Horsell.Quotation.BL.Reports.RestaurantMasterReport.<.ctor>b__45(RatingFigureCalculator p) in D:\Projects\Horsell.Quotation\Horsell.Quotation\Shivam.Horsell.Quotation.BL\Reports\RestaurantMasterReport.cs:99
System.Linq.WhereSelectListIterator2.MoveNext() +113
System.Linq.Enumerable.Sum(IEnumerable
1 source) +92
System.Linq.Enumerable.Sum(IEnumerable1 source, Func
2 selector) +58
Shivam.Horsell.Quotation.BL.Reports.RestaurantMasterReport.<.ctor>b__7(<>f__AnonymousType24 c) in D:\Projects\Horsell.Quotation\Horsell.Quotation\Shivam.Horsell.Quotation.BL\Reports\RestaurantMasterReport.cs:48
System.Linq.WhereSelectListIterator
2.MoveNext() +107
System.Collections.Generic.List1..ctor(IEnumerable
1 collection) +7663156
System.Linq.Enumerable.ToList(IEnumerable`1 source) +61
Shivam.Horsell.Quotation.BL.Reports.RestaurantMasterReport..ctor(DateTime startDate, DateTime endDate) in D:\Projects\Horsell.Quotation\Horsell.Quotation\Shivam.Horsell.Quotation.BL\Reports\RestaurantMasterReport.cs:47
Shivam.Horsell.WebUI.Biteme.Run(Object sender, EventArgs e) in D:\Projects\Horsell.Quotation\Horsell.Quotation\Shivam.Horsell.WebUI\Biteme.aspx.cs:43
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
I'm using Adapter
I'm using .Net 3.5SP1
I'm using SQL 2005 Standard Edition
Inheritence hierachy:
The entity that is throwing the error is part of an inheritence hierarchy which looks like this:
RestaurantProductDetail table inherits ProductDetail table.
I'm not custom templates but I am using a custom task performer than build only one dal project, so the database specific stuff is in the same library, otherwise it's the same as the vanilla performers.
I've already posted the linq query used to get the objects. I originally thought this error was only occurring for the CustomerQuotationUsingCustomerQuotationId but it's actaully happening when I try to read any of the prefetched objects from RestaurantProductDetailEntity (see the linq query).
There is no problem when I use the non-linq approach (adapter.FetchEntityCollection).
Heres an example of a line that calls the property where an exception is thrown: (note "productDetail" is of type RestaurantProductDetailEntity).
int rateVersion = productDetail.CustomerQuotationUsingCustomerQuotationId.RateVersion;
But this line works fine:
int rateVersion = ((ProductDetailEntity)productDetail).CustomerQuotationUsingCustomerQuotationId.RateVersion;