arschr wrote:
So it would be great if there was a way to formulate a list kind of thing in-code from fields in a graph of entities (which is actually a projection) WITHOUT actually projecting the data, so altering the values in the list is reflected in the graph?
Yes, but better than doing it in code would be to create the list of fields in the designer (so the are stored in the project) and then if it can't be described in the designer, the binding (setting events, etc) to the distant values could be done in code.
I don't think that will ever happen. See below.
it doesn't always make sense for the entity (which is very important!). So for a view, or LIST of fields (e.g typed list but then in code) it makes sense, but not for an entity to have these fields all in one place.
I'm not sure I'm understanding you completely. I think I remember, you like to see entities as relating very closely (1 to 1) to tables in the db?
No an entity is a group of attributes forming the abstract definition of an entity. So in theory, you can do:
Select o.orderid, c.companyname from orders o join customers c on ...
and you'll have a new entity: o.orderid & c.companyname.
The thing is though, that this projection is 1-way. And we already have that: either a typedlist (designer) or a dynamic list (code) and even with projections from a datareader.
So if you want it 2-way, you can't use this, as you then need a reverse projection back: what if value X changes.. etc. The entity above: can you save these when I change the companyname? Probably not, as there's no customerid and no values for non-null fields.
I see these virtual fields as viewports the entity provides to other information, it could be a value of a field on a remote entity or the sum of a set of values from remote child collections (for example open order count and total open order amount displayed on a customer entity, even though that detail is several levels away). I don't think it is important that they be updateable in the hosting entity and while it would be nice if the things that make them up would notify the host when they changed, it would be a step forward if the host had to poll them for their current values.
I think the critical thing is to give a way to define the place holder in the entity designer. The developer can take responsibility for providing the value.
One thing you have to know: there's a big difference between what's necessary for the entity to be an entity with valid data and what's necessary to paint a list of values on a screen.
What you describe above is a typedlist. The fields mapped on related fields are actually pretty much there for databinding purposes as they're simply allowing you to show a list with fields from other entities in that same list.
My proposal above is a component where you in code define the fields from a graph (including relations how to navigate) and eventually expressions, which make up the columns of the list, and then you put in a graph and the list materializes as a view over the graph.
The fancy thing is: it IS updateable, as the fields in the list are ports to the fields in the entities, perhaps deep inside the graph.
It's a way to create a new 'entity' by defining a projection which is updatable as it's not really a projection (as the object representing the list has the ability to pass data back and forth to fields). Putting all these fields inside a real entity in the designer is IMHO pretty much not what you want, as they are NOT part of that entity. I already find the fields mapped onto related fields pretty much not that great, but it's an easy way to make databinding work easier. however, if that would be possible for a myriad of fields from the graph the entity is part of, event nightmares are bigger than you and I can imagine and I definitely won't go there: a pattern like MVC has taught the world that it is much better for that purpose and my proposal is actually a different viewer on top of the same model (graph)