Wavel wrote:
It's a string that comes back from a subquery within the query. It will either contain the string "tracking" or null.
It might be better if I give you the entire issue: I am converting from EF6 to EF Core and I have a table-valued function in sql server. It would be great if I could do
var r = db.Results.FromSql("select * from function")
where Results is a class that would have the fields returned from the function. I was not able to make that work with llblgen.
EF Core doesn't support table valued functions so we can't support that in the designer.
So, instead, I want to create an entity in llblgen and rewrite the sql function in linq directly.
I think it's easier in this particular case to write the type directly as a C# class. The thing is: the designer can't map it on anything so it can't keep it in sync with the thing it is mapped on. A typed list would suffice here (which would give you a type in C#) if you wouldn't have any expression fields as well.
The generated typedlist is a linq query and a type it projects to. To extend that with field expressions isn't going to work as you can't extend the linq query (as the projection is in the query as a select).
example:
public IQueryable<CustomerOrderTypedListRow> GetCustomerOrderTypedList()
{
var current0 = this.Customers;
var current1 = from customer in current0
join order in this.Orders on customer.CustomerId equals order.Customer.CustomerId into joinresult_1
from order in joinresult_1.DefaultIfEmpty()
join orderDetails in this.OrderDetails on order.OrderId equals orderDetails.Order.OrderId
select new {order, customer, orderDetails };
return current1.Select(v=>new CustomerOrderTypedListRow() { ContactName = v.customer.ContactName, CustomerId = v.customer.CustomerId, EmployeeId = v.order.Employee.EmployeeId, OrderId = v.order.OrderId, OrderDate = v.order.OrderDate, ProductId = v.orderDetails.Product.ProductId, Quantity = v.orderDetails.Quantity } );
}
This is a generated typed list. If the data you want to use in the expression is in the projected set, you can add the code in a partial class to the type it projects to, but other than that, it's a bit difficult to do I think.