Pytanie : System.InvalidCastException unhandled użytkownik kod Błąd kod na LINQ

var zapytanie = (od rozkaz w context.MyOrderDetails
dokąd order.UserDomainName == userName
wybrany nowy
{
order.AccountID,
order.OrderNumber,
order.OrderStatus,
order.StartDate,
order.EndDate,
rozkaz. Advertiser,
rozkaz. Campaigne,
order.BookedRevenue,
order.CreativeCount,
order.MissingCreative,
order.MissingCreative,
order.MissingCount,
order.CreativeCount,
order.NotStartedCount,
order.OrderItemActiveCount,
order.OrderItemCompletedCount,
order.OrderItemCount,
order.BookedImpressions,
order.UACount,
order.UAThroughRate,
order.UACPM,
order.UADeliveredImpressionCount,
order.UADeliveredRevenue,
                                     order.UAImpressionGoal,
order.UACount,
order.MissingCount,
order.MissingCreative31to45Count,
order.MissingCreative46to60Count,
order.MissingCreative61to90Count,
order.OrderLifeToDateClickCount,
order.OrderDeliveredImpressionCount,
order.OrderLifeToDateDiscountedSalesUSD,
order.OrderLifeToDateScheduledImpressionCount,
order.ActiveState,
order.OrderProposalExpirationDate,
order.OrderProposalExtensionCount,
order.UAOrderedImpressionCount,
order.UAPacingLTDDeliveredImpressionCount,
order.UAPacingLTDScheduledImpressionCount,
order.UAPacingPct,
order.PremiumLateCreativeCount,
order.PremiumMissingCreative16to30Count,
order.PremiumAssignedCreativeCount,
order.PremiumMissingCreativeCount,
order.PrimaryAeName,
order.UAScheduledImpressionCount,
order.TotalDayCount,
                                     order.UserDomainName,
order.UADeliveredImpressionPercent,
order.DraftOrderCount,
order.ProposedOrderCount,
order.ApprovedOrderCount,
rozkaz. Filter_OrderGroup,
rozkaz. Filter_LineofBusiness,
rozkaz. Filter_Status,
rozkaz. Filter_ActiveState,
rozkaz. Filter_StartdateNext30,
rozkaz. Filter_StartdateNext60,
rozkaz. Filter_StartdateNext90,
rozkaz. Filter_EndDateNext30,
rozkaz. Filter_EndDateNext60,
rozkaz. Filter_EndDateNext90,
order.LineEvent,
order.IsFavorite,
order.ClientID
}) .ToList ();

It dawać the the wiązka errors

System.InvalidCastException unhandled użytkownik code
Message=Unable przedmiot typ "DataServiceOrderedQuery [<>f__AnonymousType2 `65 [System.String, System. Zawiązywać, System.String, System.Nullable `1 [System.DateTime], System. Nullable `(1) [System.DateTime], System.String, System. String, System.Decimal, System. Nullable `(1) [System.Int32], System. Nullable `(1) [System. Int32] , System.Nullable `(1) [System. Int32], System.Nullable `1 [System.Int32], System.Nullable `(1) [System.Int32], System. Nullable `(1) [System.Int32], System. Nullable `(1) [System. Int32] , System.Nullable `(1) [System. Int32], System.Nullable `1 [System.Int32], System.Decimal, System.Decimal, System.Nullable `(1) [System.Decimal], System. Nullable `(1) [System. Decimal], System.Nullable `1 [System.Decimal], System. Decimal, System.Decimal, System. Decimal, System.Nullable `(1) [System.Int32], System.Nullable `1 [System.Int32], System. Nullable `(1) [System.Int32], System. Nullable `(1) [System. Int32], System.Decimal, System.Decimal, System.Decimal, System.Decimal, System.String, System.Nullable `1 [System.DateTime], System. Int32, System.Decimal, System. Decimal, System.Decimal, System. Nullable `(1) [System.Decimal] , System.Nullable `(1)[System. Int32], System.Nullable `1 [System.Int32], System.Nullable `(1) [System.Int32], System. Nullable `(1) [System.Int32], System. String, System.Decimal, System. Int64, System.String, System.Nullable `(1) [System.Decimal], System. Nullable `(1) [System. Int32] , System.Nullable `(1) [System. Int32], System.Nullable `1 [System.Int32], System.String, System. String, System.String, System. String, System.Nullable `(1) [System. Byte], System.Nullable `(1) [System.Byte], System.Nullable `1 [System.Byte], System.Nullable `1 [System.Byte], System.Nullable `(1) [System.Byte], System. Nullable `(1) [System.Byte], System. String, System.Int32, System.Nullable `1 [System.Int64]]]" typ "System.Data.Services.Client.DataServiceQuery `1 [Microsoft.Advertising.SalesDashboard. Modules. OrderPerformance. Models.OrderPerformance. MyOrderDetails]".
StackTrace:
przy Microsoft.Advertizing.SalesDashboard.Modules.OrderPerformance. Services. OrderRepository.<>c__DisplayClass85.erDetailsDrillDown>b__83 (PerformanceEntities kontekst)
przy System.Linq.Observable.<>c__DisplayClass275 `2.<>c__DisplayClass277.

Odpowiedź : System.InvalidCastException unhandled użytkownik kod Błąd kod na LINQ

Niektóre pytanie.
Dlaczego IMyOrderDetails definiować? Być ono klasa ty tworzyć?
Ty wybierać wszystkie the pole od the stołowy MyOrderDetails w the wybrany klauzula?
Inne rozwiązania  
 
programming4us programming4us