powered by simpleCommunicator - 2.0.51     © 2025 Programmizd 02
Форумы / ADO.NET, LINQ, Entity Framework, NHibernate, DAL, ORM [игнор отключен] [закрыт для гостей] / IQueryable join IEnumerable
2 сообщений из 2, страница 1 из 1
IQueryable join IEnumerable
    #37648862
dolbus
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Доброго времени! Помогите разобраться плиз. Есть такой код:
Код: c#
1.
2.
3.
4.
5.
6.
7.
var vids = from v in versions
		    join a in DbContext.AttributeValues on v.ID equals a.ObjectVersionID
                          join x in attrs on a.AttributeID equals x.id
                          where a.Value == x.value
                          select v;

int res = vids.Count();



attrs имеет тип
Код: c#
1.
Dictionary<string, MyInfo>

. На последней строке вываливается NotSupportedException c cообщением "Unable to create a constant value of type 'System.Collections.Generic.KeyValuePair`2'. Only primitive types ('such as Int32, String, and Guid') are supported in this context."

Как мне правильно сделать join с attrs?
...
Рейтинг: 0 / 0
IQueryable join IEnumerable
    #37648874
dolbus
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Извиняюсь, не так скопипастил.)

Код: c#
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
var attrs = from d in attributes.AsQueryable()
		                select new {id = d.Value.AttributeID, value = d.Value.Value};

var vids = from v in versions
		    join a in DbContext.AttributeValues on v.ID equals a.ObjectVersionID
                          join x in attrs on a.AttributeID equals x.id
                          where a.Value == x.value
                          select v;

int res = vids.Count();




attributes имеет тип
Код: c#
1.
Dictionary<string, MyInfo>


. На последней строке вываливается NotSupportedException c cообщением "Unable to create a constant value of type 'System.Collections.Generic.KeyValuePair`2'. Only primitive types ('such as Int32, String, and Guid') are supported in this context."

Как мне правильно сделать join с attrs?
...
Рейтинг: 0 / 0
2 сообщений из 2, страница 1 из 1
Форумы / ADO.NET, LINQ, Entity Framework, NHibernate, DAL, ORM [игнор отключен] [закрыт для гостей] / IQueryable join IEnumerable
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]