推奨される LLBLGen 構文を使用して投影を照会しようとしています ( http://www.llblgen.com/documentation/3.5/LLBLGen%20Pro%20RTF/Using%20the%20generated%20code/Adapter/gencode_usingentityview_adapter.htm#projections )
IEntityView2 view = table.DefaultView;
List<A1AllocationHelp1TableDTO> something =
(from c in view
select new A1AllocationHelp1TableDTO
{
RecordStatus = c.RecordStatus,
UniqueIdent = c.UniqueIdent
}).ToList();
しかし、「select」で次のエラーが発生します。
The type arguments for method 'IEnumerable<TResult>
System.Linq.Enumerable.Select<TSource, TResult>(this IEnumerable<TSource>,
Func<TSource, TResult>)' cannot be inferred from the query.
おもしろいのは、VB.Net でも同じことがうまく機能することです。
Dim view As IEntityView2 = table.DefaultView
Dim something As List(Of A1AllocationHelp1TableDTO) = _
(From c In view
Select New A1AllocationHelp1TableDTO With _
{
.RecordStatus = c.RecordStatus, _
.UniqueIdent = c.UniqueIdent
}).ToList()
VS2010、.NET 4、および LLBLGen 2.6 を使用しています。これを修正する方法がわかりません 誰かが私に手を差し伸べることができますか?
ありがとう
編集:
IEntityView2 は LLBLGen によって生成され、これがその定義です
public interface IEntityView2 : IEnumerable
{
bool AllowEdit { get; set; }
bool AllowNew { get; set; }
bool AllowRemove { get; set; }
int Count { get; }
PostCollectionChangeAction DataChangeAction { get; set; }
IPredicate Filter { get; set; }
IEntityCollection2 RelatedCollection { get; }
ISortExpression Sorter { get; set; }
IEntity2 this[int index] { get; }
event ListChangedEventHandler ListChanged;
bool Contains(IEntity2 value);
void CreateProjection(List<IEntityPropertyProjector> propertyProjectors, DataTable destination);
void CreateProjection(List<IEntityPropertyProjector> propertyProjectors, IEntityCollection2 destination);
void CreateProjection(List<IEntityPropertyProjector> propertyProjectors, IEntityDataProjector projector);
void CreateProjection(List<IEntityPropertyProjector> propertyProjectors, DataTable destination, bool allowDuplicates);
void CreateProjection(List<IEntityPropertyProjector> propertyProjectors, IEntityCollection2 destination, bool allowDuplicates);
void CreateProjection(List<IEntityPropertyProjector> propertyProjectors, IEntityDataProjector projector, bool allowDuplicates);
void CreateProjection(List<IEntityPropertyProjector> propertyProjectors, DataTable destination, bool allowDuplicates, IPredicate filter);
void CreateProjection(List<IEntityPropertyProjector> propertyProjectors, IEntityCollection2 destination, bool allowDuplicates, IPredicate filter);
void CreateProjection(List<IEntityPropertyProjector> propertyProjectors, IEntityDataProjector projector, bool allowDuplicates, IPredicate filter);
int IndexOf(IEntity2 value);
IEntityCollection2 ToEntityCollection();
IEntityCollection2 ToEntityCollection(int startIndex);
}