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?
Explicit construction of entity type in query is not allowed
Yes, that worked. Nevertheless, if i try to generate the SearchCustomer entity through Entity Developer, a Table attribute is inserted with an empty name even if i don't specify a Source for it. What is the point of this? Wouldn't be better for the Entity Developer not to generate a Table attribute at all? This way, all the unbounded entities could be properly maintained through it.
Thank you for the suggestion, we are already working on it.
The entities with empty Source propery will not have the Table attribute.
As a temporary workaround, I recommend you to move the code associated with the SearchCustomer entity
to the DataContext.cs class (it is not affected by model changes).
The entities with empty Source propery will not have the Table attribute.
As a temporary workaround, I recommend you to move the code associated with the SearchCustomer entity
to the DataContext.cs class (it is not affected by model changes).