Commit Graph

24 Commits

Author SHA1 Message Date
agrath
e731fb5b03 Fixed an issue with && in DynamicNodeList.Where causing False&&False to be true 2011-12-19 13:51:11 -13:00
agrath
407f78c84b Made OrderBy(Name) and OrderBy(name) work the same as OrderBy(nodeName) 2011-10-09 06:16:24 -13:00
agrath
c097b0f250 Prevented OrderBy from throwing an error when presented with an empty list 2011-09-01 08:45:43 -12:00
agrath
265fc0b3ca Improved the handling of DynamicNull when using OrderBy 2011-08-29 11:19:34 -12:00
agrath
4d3c145be9 Added support to DynamicQueryable to support property accesses via reflection on DynamicNode properties, e.g. list.GroupBy(uBlogsyPostDate.Date) 2011-08-18 14:30:42 -12:00
agrath
f361e20482 Traced exception message out on DynamicNode 2011-08-11 15:36:54 -12:00
agrath
e72bd130e3 Further changes to fix bug with 'incorrect number of lambda paramters' issue with .Where when using && and || 2011-07-26 14:02:25 -12:00
agrath
ae3357de0d Fixed a bug with .Where && and || throwing invalid number of parameters for lambda when both left & right were not lambdas, e.g. Visible && NodeTypeAlias != umbNewsArticleItem 2011-07-24 13:55:36 -12:00
agrath@gmail.com
31169380f8 Changed the return type of RTE to a different HtmlString (internal) so that it can be implicitly convertible for string for If comparisons. Added an extension method for string.HasValue so that .Where can invoke it to improve readibility when comparing RTE to empty string based on feedback from @cultiv. Cleaned up an empty if in DynamicQuerable 2011-07-21 20:19:54 -12:00
agrath@gmail.com
e8a941fc1f Added support for invoking extension methods on native properties on DynamicNode where the native property type is string (e.g. NodeTypeAlias, Name). Half fixes ContainsAny support 2011-07-21 11:25:15 -12:00
agrath@gmail.com
10672f02a1 Fixed .OrderBy with single properties which are implemented as actual properties (e.g. Level, CreateDate, UpdateDate) - dynamic properties should have ordered correctly 2011-03-25 09:47:00 -13:00
agrath@gmail.com
9a56886f1d Made !, != true more robust when property may not exist on a node
Fixed some cases of && breaking where the wrong number of parameters was passed to the LambdaExpression
2011-03-25 09:34:39 -13:00
agrath@gmail.com
1b060dfdbf Implemented Pluck/Select to extract a given property from a DynamicNodeList and return it as a List<T>
Example:
var colours = @Model.Children.Select("colour");
//Red, Green, Blue ...
Uses the parser from .Where internally
Aliased as .Pluck
2011-03-12 16:29:02 -13:00
agrath@gmail.com
b624d7479a Fixes work item: 30156, using prop.Contains(string) || !prop.Contains(string)
Added ContainsInsensitive extension method for use inside .Where (fixed method finder too)
2011-03-12 12:33:09 -13:00
agrath@gmail.com
f5a7001859 Fixed handling of get properties on DynamicNode when used in a BinaryExpression and neither side is a LambdaExpression 2011-03-09 07:42:43 -13:00
agrath@gmail.com
9949420c6d Change HasAccess and IsProtected to be getters so they can be used in .Where
http://umbraco.codeplex.com/workitem/30096

Add support to DynamicQueryable for accessing properties that are not dynamic and are actually defined on DynamicNode
2011-03-08 18:38:06 -13:00
agrath@gmail.com
aaa90bea14 More graceful handling of missing properties in .Where - TryGetMember now returns DynamicNull
Only return DynamicNull if property truely doesn't exist - if it does exist and has no value, still return null
2011-02-27 22:55:50 -13:00
agrath@gmail.com
60c18bdff9 More graceful handling of missing properties in .Where - TryGetMember now returns DynamicNull (IEnumerable with fake .Where and .OrderBy) when the property/child type doesn't exist.
Expression Tree in DynamicQueryable explictly checks for this type and forces that portion of the predicate/expression tree to return true, bypassing the missing property
Handy when you are checking e.g. a boolean property in a .Where and that boolean doesn't exist on all nodes.
2011-02-27 21:53:45 -13:00
agrath@gmail.com
cbe94ae6aa Refactored ExtensionMethod search code from DynamicNodeList (searches for extension methods e.g. .Random()) to tidy it up
Moved Extension Method searching code to seperate static class
Moved all the defined extension methods for DynamicNode into the same ExtensionMethods.cs file
Changed the way that .ContainsAny within a where is evaluated to use the ExtensionMethodFinder class - should allow extra search methods to be defined
2011-02-26 16:15:45 -13:00
agrath@gmail.com
a32e8894cd Added support for calling non standard extension method style helpers within a .Where
Intended as a future extensibility point, provides a way for the parser to redirect into a static method library of helpers
Currently, only one method is available - ContainsAny
Functions like string.Contains but uses needles from a List<string>

var values = new Dictionary<string,object>();
var keywords = new List<string>();
keywords.Add("Five");
keywords.Add("Four");
values.Add("keywords",keywords);
var items = @Model.Children.Where("Name.ContainsAny(keywords)", values);
2011-02-26 11:12:06 -13:00
agrath@gmail.com
6d615e6762 Work on DynamicQueryable to support .Where("bodyText.Contains(\"string\")")
Chaining works too: .Where("Name.SubString(1,3).Contains(\"v\")");
2011-02-25 16:58:17 -13:00
agrath@gmail.com
b1ff0db8fe Work on DynamicQueryable to support .Where("shouldBeVisible && Level < 4") rather than .Where("shouldBeVisible == true && Level < 4")
Confirmed other test cases of .Where still work
2011-02-25 12:16:03 -13:00
agrath@gmail.com
9b45a81f22 Rewrote implementation of HandleDynamicNodeLambdas in DynamicQueryable.cs to be easier to read and handle unboxing and type conversion when the output type of the lambda is convertable between the left and right side.
Allows this syntax to work now:
@Model.Children.Where("updateDate < DateTime.Now.AddDays(-2)")
This didn't work previously in 4.7beta because updateDate was still boxed as an object and object < DateTime can't be implicitly converted

@Model.Children.Where("bodyText.Contains('ipsum')") still doesn't work because the parser doesn't know how to invoke .Contains on a LambdaExpression (yet)
2011-02-25 00:39:53 -13:00
agrath@gmail.com
603a12c5a0 Split umbraco.MacroEngines.Juno into two subfolders (namespaces remain the same)
RazorCore contains all the core razor engine implementation
RazorDynamicNode contains all the DynamicNode functionality and associated support files
2011-02-24 16:05:54 -13:00