Explicit construction of entity type in query is not allowed
Posted: Thu 16 Jul 2009 11:38
Hello,
I query 2 DB Entities, Customer & CustomerInfo using DotConnect for Oracle. At the end of my query, i need to create an Entity which is not bound to a DB Table and is made by me, SearchedCustomer. The query is this:
IQueryable result = query.Select(a => new SearchedCustomer
{
Id = (long) a.Customer.Id,
Code = a.Customer.Code,
AccountName = a.CustomerInfo.AccName,
TaxRegNo = a.CustomerInfo.TaxRegno,
IdCardNo = a.CustomerInfo.Identity,
Balance = (decimal) a.Customer.Balance,
BalanceAge=(int)a.Customer.BalAge,Status=a.Customer.Status});
List objCustomers = result.ToList();
Last line raises an error :
{"Explicit construction of entity type 'ExrayEntities.SearchedCustomer' in query is not allowed."}
Funny thing is that using version 5.20.33 of DotConnect for ORacle, everything worked ok. Using the latest version 5.25.37, i get the aforementioned error.
Do i need to change something in the way i design things?
I query 2 DB Entities, Customer & CustomerInfo using DotConnect for Oracle. At the end of my query, i need to create an Entity which is not bound to a DB Table and is made by me, SearchedCustomer. The query is this:
IQueryable result = query.Select(a => new SearchedCustomer
{
Id = (long) a.Customer.Id,
Code = a.Customer.Code,
AccountName = a.CustomerInfo.AccName,
TaxRegNo = a.CustomerInfo.TaxRegno,
IdCardNo = a.CustomerInfo.Identity,
Balance = (decimal) a.Customer.Balance,
BalanceAge=(int)a.Customer.BalAge,Status=a.Customer.Status});
List objCustomers = result.ToList();
Last line raises an error :
{"Explicit construction of entity type 'ExrayEntities.SearchedCustomer' in query is not allowed."}
Funny thing is that using version 5.20.33 of DotConnect for ORacle, everything worked ok. Using the latest version 5.25.37, i get the aforementioned error.
Do i need to change something in the way i design things?