Jez wrote:
Otis wrote:
However as you also said: the indexer is a bit awkward. It can also suggest to fetch for the 1st order the orderdetails
Agreed. One of my colleagues mentioned the same thing
I really don't like that indexer, but I can't think of a better way of doing it without sticking type-parameters all over the place.
True... The problem is the multi-branched paths inside a single line, and you have just 1 direction of extensibility: the params parameter, but should that contain new path nodes of the parent, or new path nodes of the path specified?
. That's why I added PathEdge, as that introduces the second direction of extensibility inside the methods.
Otis wrote:
due to the nature of extension methods, it's easy to share code like you wrote with others through 3rd party downloads, if we decide not to include your proposed api syntaxis.
Yep...thats one great thing about extension methods. If only there were extension properties too...
yes... The last MVP summit in march 2007 we asked this to the c# team and they agreed it could be useful, but then started to babble about irrelevant things, so it came down to: THEY didn't need it for linq so it's not in the language. Which is sad, because they didn't look at the language and added what was necessay to get the language forward, they added things to get linq implemented.
Otis wrote:
Probably won't work due to the generics which aren't inferrable(?) through the method I think.
I think it'd need to include some extra type parameters, which makes it a bit more cumbersome.
Yes I agree. In my initial design I thought these types were inferred by the compiler but that wasn't the case unfortunately, I couldn't get it compiled, as a type used inside a lambda isn't inferring the type of the method.:
public void Foo<T, U>(Func<T, U> func, ...)
here, if you specify a lambda which defines T and U, like c=>c.Orders, it doesn't work, as a lambda apparently can't define the T and U types, you have to specify them...
At least I couldn't get it to work, I had to specify at least U.
Otis wrote:
So EntityCollection<T> also should get an extension method, but it then gets awkward as well, as that one will popup in normal code as well...
This is one of the reasons that I was trying to fit everything on line line...this way, there's only 1 extension method on IQueryable<T>, and you don't have to pollute EntityCollection or EntityBase with extra extension methods, which seems messy.
Yes I agree.
Though, isn't there a way to make PathEdge better perhaps, so your concerns are solved with a better PathEdge design? As I said earlier, the current design of PathEdge isn't my favorite but it's the one which worked, and as you were the one who said if there wasn't a better alternative, perhaps a better PathEdge is possible...