Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/303.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 异常:指定的类型成员';LineColor';在LINQ to实体中不支持_C#_Entity Framework_Linq - Fatal编程技术网

C# 异常:指定的类型成员';LineColor';在LINQ to实体中不支持

C# 异常:指定的类型成员';LineColor';在LINQ to实体中不支持,c#,entity-framework,linq,C#,Entity Framework,Linq,我在使用linq分配字节[]中的值时遇到以下异常 LINQ to实体中不支持指定的类型成员“LineColor”。只支持初始值设定项、实体成员和实体导航属性 下面是代码 (from v in _DWEntities.DimScheduleJourneys join od in _DWEntities.OperatingDateVehicleJourneyMappings on v.VehicleJourneyUID equals od.VehicleJourney

我在使用linq分配字节[]中的值时遇到以下异常

LINQ to实体中不支持指定的类型成员“LineColor”。只支持初始值设定项、实体成员和实体导航属性

下面是代码

(from v in _DWEntities.DimScheduleJourneys
                join od in _DWEntities.OperatingDateVehicleJourneyMappings on v.VehicleJourneyUID equals od.VehicleJourneyUID
                where od.OperatingDateKey == _operatingDate && (vehicleJourneyUID == null || v.VehicleJourneyUID == vehicleJourneyUID)
                && (v.ScheduleDeparture != null && v.ScheduleDeparture != "" && v.ScheduleArrival != null && v.ScheduleArrival != "")
                select new ScheduleJourney
                {
                    VehicleJourneyUID = v.VehicleJourneyUID,
                    VehicleJourneyID = v.VehicleJourneyID,
                    TransportMode = v.TransportMode,
                    JourneyCode = v.JourneyCode == null ? v.VehicleJourneyCode : v.JourneyCode,
                    DepartureTime = v.ScheduleDeparture,
                    DirectionID = v.DirectionID,
                    BlockID = od.BlockId.Value,
                    BlockNumber = od.BlockNumber,
                    DutyBoard = od.DutyBoard,
                    DutyBoardID = od.DutyBoardID,
                    LineUID = v.LineUId,
                    LineName = v.LineName,
                    LineColor = v.LineColor,
                    //LineColor = v.LineName,
                    ServiceID = v.ServiceID,
                    ServiceCode = v.ServiceCode,
                    OperatorID = v.OperatorId,
                    OperatorCode = v.OperatorCode,
                    OperatorName = v.OperatorName,
                    JourneyPatternUID = v.JourneyPatternUID,
                    FirstStopPoint = v.FirstStopPoint,
                    LastStoppoint = v.LastStopPoint,
                    FirstStopPointName = v.FirstStopPointName,
                    LastStopPointName = v.LastStopPointName,
                    EndTime = v.ScheduleArrival,
                    OperatingDate = od.OperatingDate,
                    JourneyAccessibility = v.WheelchairAccessible.HasValue ? v.WheelchairAccessible.Value : false,
                    TenantId = v.TenantId.HasValue ? v.TenantId.Value : new Guid(),
                    DeadRunStartTime = v.DeadRunStartTime,
                    DeadRunEndTime = v.DeadRunEndTime,
                    MarketingName = v.MarketingName,
                    PrivateCode = v.PrivateCode,
                    //   GarageID = v.GarageID,
                    GarageCode = v.GarageCode,
                    IsFrequentService = v.FrequentService.HasValue ? v.FrequentService.Value : false,
                    FrequentServiceInterval = v.ScheduleFrequency,
                    Origin = v.Origin,
                    Destination = v.Destination,
                    IsMasterJourney = v.IsMasterJourney
                });
这里我的线条颜色是byte[]

请帮助解决此异常


提前感谢

您能在实体类中发布整个LineColor声明吗?LineColor没有标记为NotMapping,对吗?在sql中,LineColor数据类型为varbinary,实体(C#)类为byte[]。所以每次实体在行颜色中取空值。根据我的RND实体无法获取varbinary数据类型值。我不确定,但由于null Linq无法处理,您可以在实体类中发布整个LineColor声明吗?LineColor未标记为NotMapped,对吗?在sql中,LineColor数据类型为varbinary,实体(C#)类为byte[]。所以每次实体在行颜色中取空值。根据我的RND实体无法获取varbinary数据类型值。我不确定,但由于null,Linq无法处理