سلام خدمت استاد گرامی
علت خطا چی هست؟فکر کنم از روابط باشه چون این فیلدها درج میشه اتوماتیک
InvalidOperationException: The LINQ expression 'DbSet<CourseEpisode>()
.Where(c0 => EF.Property<Nullable<int>>(EntityShaperExpression:
EntityType: Course
ValueBufferExpression:
ProjectionBindingExpression: EmptyProjectionMember
IsNullable: False
, "CourseId") != null && object.Equals(
objA: (object)EF.Property<Nullable<int>>(EntityShaperExpression:
EntityType: Course
ValueBufferExpression:
ProjectionBindingExpression: EmptyProjectionMember
IsNullable: False
, "CourseId"),
objB: (object)EF.Property<Nullable<int>>(c0, "CourseId")))
.Sum(c0 => c0.EpisodeTime.Ticks)' could not be translated. Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly by inserting a call to 'AsEnumerable', 'AsAsyncEnumerable', 'ToList', or 'ToListAsync'. See https://go.microsoft.com/fwlink/?linkid=2101038 for more information.
لطفا کدتون رو بزارید تا ببینیم مشکل کد کجاست!
به نظر اون کدی که زدید مشکل داره
ایراد از این خط کد :
TotalTime = new TimeSpan(c.CourseEpisodes.Sum(e => e.EpisodeTime.Ticks))
ایت خط رو پاک کنید ، در انتهای دوره درستش کردیم و توضیح دادم
مرسی استاد عزیز دستت طلا