Commit Graph

6 Commits

Author SHA1 Message Date
hartvig
b5c78d397d Updates to fetching extension methods in a more stable way in DynamicNodeList 2011-02-18 13:02:20 -01:00
agrath@gmail.com
d9f420d45a Added .OrderBy method to DynamicNodeList
Only supports single pass, ascending currently, so no ThenBy implementation or Descending variants
The original query parser supports OrderBy("catCount, name desc") by nesting Expression.Call
Current implementation for DynamicNodeList supports OrderBy("catCount") only
2011-02-17 14:52:05 -13:00
agrath@gmail.com
070a03e827 Fixed DynamicNodeList extension method invocation finding the wrong method when the method being checked was defined on a class that implemented no interfaces
Caused user-loaded extension methods on DynamicNodeList to be pretty unreliable (would work sometimes, sometimes wouldn't find method - particularly after an iisreset)
2011-02-07 15:29:44 -13:00
agrath@gmail.com
bcf735f4f8 Added support for DynamicLinq in place of Lambda syntax. The short version is you can't use a Lambda with a DynamicNode
e.g. @Model.Children.Where(node=>node.shouldBeVisible)
To solve this, I used the DynamicQueryable class from the Linq samples which has a parser that can take a string then modified the internals a bit so
that if your object is a DynamicObject, an additional expression tree is generated which calls the TryGetMember on it
The end result is that you can now do this [I have Random(this DynamicNodeList nodes, int max) in my bin folder]
@Model.Children.Where("shouldBeVisible").Random(2) => two nodes, randomly picked, from the ones that should be visible
*Only* Where is implemented here currently, I'll add support by OrderBy and ThenBy after I've tested some more complex scenarios.
I need to fix a small issue with my DynamicLoading of extensions - under some scenarios the class doesn't get found and i'm not sure why.
2011-02-06 19:52:05 -13:00
agrath@gmail.com
5a5ccfea98 Changed reflection of assemblies to all assemblies in bin folder via BuildManager instead of currently loaded assemblies 2011-02-02 13:05:10 -13:00
agrath@gmail.com
799d718881 Refactored my implementation of IEnumerables being returned from .Children etc to return a new type called DynamicNodeList instead of a DynamicNode (singular) containing a nested list.
This makes the code cleaner and also allows for the .Items (underlying initialization data for DynamicNodeList) to be exposed when you have an instance and hide all of the singular properties etc (Url, Name) that are on DynamicNode - they're not applicable for a List.
Rewrote the reflection code for calling methods on DynamicNodeList to allow mix-ins (e.g. external dlls) to have an extension method defined for DynamicNodeList (e.g. Random(nodeCount))
Lambda syntax still doesn't work (e.g. Children.Where(item=>item.shouldBeVisible)) however methods that don't take lamdas (Take, Random[external], Skip, ElementAt, First, etc) work
2011-02-02 11:52:09 -13:00