From f2b6400078a8e6cd2b2292df542a50b547f6d85d Mon Sep 17 00:00:00 2001 From: Mpdreamz Date: Fri, 4 Nov 2016 16:47:54 +0100 Subject: [PATCH 1/4] fix #2368 by fixing the underlying problem that scalars should be easier to map inside the fluent properties descriptor --- .../Mapping/DynamicTemplate/SingleMapping.cs | 107 +++++++++- src/Nest/Mapping/Types/Properties-Scalar.cs | 183 ++++++++++++++++++ src/Nest/Mapping/Types/Properties.cs | 12 +- src/Nest/Nest.csproj | 1 + src/Tests/IndexModules/UsageTestBase.cs | 8 +- src/Tests/Mapping/Scalar/ScalarUsageTests.cs | 150 ++++++++++++++ src/Tests/Tests.csproj | 1 + src/Tests/tests.yaml | 2 +- 8 files changed, 458 insertions(+), 6 deletions(-) create mode 100644 src/Nest/Mapping/Types/Properties-Scalar.cs create mode 100644 src/Tests/Mapping/Scalar/ScalarUsageTests.cs diff --git a/src/Nest/Mapping/DynamicTemplate/SingleMapping.cs b/src/Nest/Mapping/DynamicTemplate/SingleMapping.cs index f3db554cd16..484dd40a47b 100644 --- a/src/Nest/Mapping/DynamicTemplate/SingleMapping.cs +++ b/src/Nest/Mapping/DynamicTemplate/SingleMapping.cs @@ -1,4 +1,5 @@ using System; +using System.Linq.Expressions; namespace Nest { @@ -6,7 +7,6 @@ public class SingleMappingDescriptor : DescriptorBase, IPropertiesDescriptor>, IPropertiesDescriptor where T : class { - [Obsolete("Only valid for indices created before Elasticsearch 5.0 and will be removed in the next major version. For newly created indices, use `text` or `keyword` instead.")] public IProperty String(Func, IStringProperty> selector) => selector?.Invoke(new StringPropertyDescriptor()); @@ -17,6 +17,10 @@ public IProperty Text(Func, ITextProperty> selector) = public IProperty Keyword(Func, IKeywordProperty> selector) => selector?.Invoke(new KeywordPropertyDescriptor()); + /// + /// Number introduces a numeric mapping that defaults to `float` use .Type() to set the right type if needed or use + /// instead of + /// public IProperty Number(Func, INumberProperty> selector) => selector?.Invoke(new NumberPropertyDescriptor()); @@ -61,5 +65,106 @@ public IProperty Generic(Func, IGenericProperty> se public IProperty Percolator(Func, IPercolatorProperty> selector) => selector?.Invoke(new PercolatorPropertyDescriptor()); + + + + public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => + selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Integer)); + + public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => + selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Integer)); + + public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => + selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Float)); + + public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => + selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Float)); + + public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => + selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Byte)); + + public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => + selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Byte)); + + public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => + selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short)); + + public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => + selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short)); + + public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => + selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short)); + + public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => + selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short)); + + public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => + selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long)); + + public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => + selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long)); + + public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => + selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long)); + + public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => + selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long)); + + public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => + selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long)); + + public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => + selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long)); + + public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => + selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double)); + + public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => + selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double)); + + public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => + selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double)); + + public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => + selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double)); + + public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => + selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double)); + + public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => + selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double)); + + public IProperty Scalar(Expression> field, Func, IDateProperty> selector) => + selector?.InvokeOrDefault(new DatePropertyDescriptor().Name(field)); + + public IProperty Scalar(Expression> field, Func, IDateProperty> selector) => + selector?.InvokeOrDefault(new DatePropertyDescriptor().Name(field)); + + public IProperty Scalar(Expression> field, Func, IDateProperty> selector) => + selector?.InvokeOrDefault(new DatePropertyDescriptor().Name(field)); + + public IProperty Scalar(Expression> field, Func, IDateProperty> selector) => + selector?.InvokeOrDefault(new DatePropertyDescriptor().Name(field)); + + public IProperty Scalar(Expression> field, Func, IBooleanProperty> selector) => + selector?.InvokeOrDefault(new BooleanPropertyDescriptor().Name(field)); + + public IProperty Scalar(Expression> field, Func, IBooleanProperty> selector) => + selector?.InvokeOrDefault(new BooleanPropertyDescriptor().Name(field)); + + public IProperty Scalar(Expression> field, Func, IKeywordProperty> selector) => + selector?.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field)); + + public IProperty Scalar(Expression> field, Func, IKeywordProperty> selector) => + selector?.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field)); + + public IProperty Scalar(Expression> field, Func, IKeywordProperty> selector) => + selector?.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field)); + + public IProperty Scalar(Expression> field, Func, IKeywordProperty> selector) => + selector?.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field)); + + public IProperty Scalar(Expression> field, Func, ITextProperty> selector) => + selector?.InvokeOrDefault(new TextPropertyDescriptor().Name(field)); } } diff --git a/src/Nest/Mapping/Types/Properties-Scalar.cs b/src/Nest/Mapping/Types/Properties-Scalar.cs new file mode 100644 index 00000000000..53de99e48a8 --- /dev/null +++ b/src/Nest/Mapping/Types/Properties-Scalar.cs @@ -0,0 +1,183 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using Newtonsoft.Json; + +namespace Nest +{ + public partial interface IPropertiesDescriptor + where T : class + where TReturnType : class + { + TReturnType Scalar(Expression> field, Func, INumberProperty> selector); + + TReturnType Scalar(Expression> field, Func, INumberProperty> selector); + + TReturnType Scalar(Expression> field, Func, INumberProperty> selector); + + TReturnType Scalar(Expression> field, Func, INumberProperty> selector); + + TReturnType Scalar(Expression> field, Func, INumberProperty> selector); + + TReturnType Scalar(Expression> field, Func, INumberProperty> selector); + + TReturnType Scalar(Expression> field, Func, INumberProperty> selector); + + TReturnType Scalar(Expression> field, Func, INumberProperty> selector); + + TReturnType Scalar(Expression> field, Func, INumberProperty> selector); + + TReturnType Scalar(Expression> field, Func, INumberProperty> selector); + + TReturnType Scalar(Expression> field, Func, INumberProperty> selector); + + TReturnType Scalar(Expression> field, Func, INumberProperty> selector); + + TReturnType Scalar(Expression> field, Func, INumberProperty> selector); + + TReturnType Scalar(Expression> field, Func, INumberProperty> selector); + + TReturnType Scalar(Expression> field, Func, INumberProperty> selector); + + TReturnType Scalar(Expression> field, Func, INumberProperty> selector); + + TReturnType Scalar(Expression> field, Func, INumberProperty> selector); + + TReturnType Scalar(Expression> field, Func, INumberProperty> selector); + + TReturnType Scalar(Expression> field, Func, INumberProperty> selector); + + TReturnType Scalar(Expression> field, Func, INumberProperty> selector); + + TReturnType Scalar(Expression> field, Func, INumberProperty> selector); + + TReturnType Scalar(Expression> field, Func, INumberProperty> selector); + + TReturnType Scalar(Expression> field, Func, IDateProperty> selector); + + TReturnType Scalar(Expression> field, Func, IDateProperty> selector); + + TReturnType Scalar(Expression> field, Func, IDateProperty> selector); + + TReturnType Scalar(Expression> field, Func, IDateProperty> selector); + + TReturnType Scalar(Expression> field, Func, IBooleanProperty> selector); + + TReturnType Scalar(Expression> field, Func, IBooleanProperty> selector); + + TReturnType Scalar(Expression> field, Func, IKeywordProperty> selector); + + TReturnType Scalar(Expression> field, Func, IKeywordProperty> selector); + + TReturnType Scalar(Expression> field, Func, IKeywordProperty> selector); + + TReturnType Scalar(Expression> field, Func, IKeywordProperty> selector); + + TReturnType Scalar(Expression> field, Func, ITextProperty> selector); + } + + public partial class PropertiesDescriptor : IsADictionaryDescriptorBase, IProperties, PropertyName, IProperty>, IPropertiesDescriptor> + where T : class + { + public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Integer))); + + public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Integer))); + + public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Float))); + + public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Float))); + + public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Byte))); + + public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Byte))); + + public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short))); + + public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short))); + + public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short))); + + public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short))); + + public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long))); + + public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long))); + + public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long))); + + public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long))); + + public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long))); + + public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long))); + + public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double))); + + public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double))); + + public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double))); + + public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double))); + + public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double))); + + public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double))); + + public PropertiesDescriptor Scalar(Expression> field, Func, IDateProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new DatePropertyDescriptor().Name(field))); + + public PropertiesDescriptor Scalar(Expression> field, Func, IDateProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new DatePropertyDescriptor().Name(field))); + + public PropertiesDescriptor Scalar(Expression> field, Func, IDateProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new DatePropertyDescriptor().Name(field))); + + public PropertiesDescriptor Scalar(Expression> field, Func, IDateProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new DatePropertyDescriptor().Name(field))); + + public PropertiesDescriptor Scalar(Expression> field, Func, IBooleanProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new BooleanPropertyDescriptor().Name(field))); + + public PropertiesDescriptor Scalar(Expression> field, Func, IBooleanProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new BooleanPropertyDescriptor().Name(field))); + + public PropertiesDescriptor Scalar(Expression> field, Func, IKeywordProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field))); + + public PropertiesDescriptor Scalar(Expression> field, Func, IKeywordProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field))); + + public PropertiesDescriptor Scalar(Expression> field, Func, IKeywordProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field))); + + public PropertiesDescriptor Scalar(Expression> field, Func, IKeywordProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field))); + + public PropertiesDescriptor Scalar(Expression> field, Func, ITextProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new TextPropertyDescriptor().Name(field))); + + } +} diff --git a/src/Nest/Mapping/Types/Properties.cs b/src/Nest/Mapping/Types/Properties.cs index 7f7f4f672f0..af3ad24085b 100644 --- a/src/Nest/Mapping/Types/Properties.cs +++ b/src/Nest/Mapping/Types/Properties.cs @@ -33,7 +33,7 @@ public Properties(Dictionary container) public void Add(Expression> name, IProperty property) => this.BackingDictionary.Add(name, property); } - public interface IPropertiesDescriptor + public partial interface IPropertiesDescriptor where T : class where TReturnType : class { @@ -42,6 +42,10 @@ public interface IPropertiesDescriptor TReturnType String(Func, IStringProperty> selector); TReturnType Text(Func, ITextProperty> selector); TReturnType Keyword(Func, IKeywordProperty> selector); + /// + /// Number introduces a numeric mapping that defaults to `float` use .Type() to set the right type if needed or use + /// instead of + /// TReturnType Number(Func, INumberProperty> selector); TReturnType TokenCount(Func, ITokenCountProperty> selector); TReturnType Date(Func, IDateProperty> selector); @@ -60,7 +64,7 @@ TReturnType Nested(Func, INestedProp TReturnType Percolator(Func, IPercolatorProperty> selector); } - public class PropertiesDescriptor : IsADictionaryDescriptorBase, IProperties, PropertyName, IProperty>, IPropertiesDescriptor> + public partial class PropertiesDescriptor : IsADictionaryDescriptorBase, IProperties, PropertyName, IProperty>, IPropertiesDescriptor> where T : class { public PropertiesDescriptor() : base(new Properties()) { } @@ -74,6 +78,10 @@ public PropertiesDescriptor() : base(new Properties()) { } public PropertiesDescriptor Keyword(Func, IKeywordProperty> selector) => SetProperty(selector); + /// + /// Number introduces a numeric mapping that defaults to `float` use .Type() to set the right type if needed or use + /// instead of + /// public PropertiesDescriptor Number(Func, INumberProperty> selector) => SetProperty(selector); public PropertiesDescriptor TokenCount(Func, ITokenCountProperty> selector) => SetProperty(selector); diff --git a/src/Nest/Nest.csproj b/src/Nest/Nest.csproj index 9362dcb3079..f88b68a449c 100644 --- a/src/Nest/Nest.csproj +++ b/src/Nest/Nest.csproj @@ -884,6 +884,7 @@ + diff --git a/src/Tests/IndexModules/UsageTestBase.cs b/src/Tests/IndexModules/UsageTestBase.cs index 480b4f029fc..af144b48c6b 100644 --- a/src/Tests/IndexModules/UsageTestBase.cs +++ b/src/Tests/IndexModules/UsageTestBase.cs @@ -12,13 +12,17 @@ public abstract class UsageTestBase : Ser protected abstract TInitializer Initializer { get; } protected abstract Func Fluent { get; } + protected virtual bool TestObjectInitializer => true; + protected UsageTestBase() { this.FluentInstance = this.Fluent(new TDescriptor()); } - [U] protected void SerializesInitializer() => - this.AssertSerializesAndRoundTrips(this.Initializer); + [U] protected void SerializesInitializer() + { + if (this.TestObjectInitializer) this.AssertSerializesAndRoundTrips(this.Initializer); + } [U] protected void SerializesFluent() => this.AssertSerializesAndRoundTrips(this.FluentInstance); diff --git a/src/Tests/Mapping/Scalar/ScalarUsageTests.cs b/src/Tests/Mapping/Scalar/ScalarUsageTests.cs new file mode 100644 index 00000000000..a785e33679c --- /dev/null +++ b/src/Tests/Mapping/Scalar/ScalarUsageTests.cs @@ -0,0 +1,150 @@ +using Nest; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tests.Framework; +using Tests.Framework.MockData; + +namespace Tests.Mapping.Scalar +{ + public class ScalarUsageTests : UsageTestBase, TypeMapping> + { + protected override bool SupportsDeserialization => false; + protected override bool TestObjectInitializer => false; + + public class ScalarPoco + { + public int Int { get; set; } + public int? IntNullable { get; set; } + + public float Float { get; set; } + public float? FloatNullable { get; set; } + + public double Double { get; set; } + public double? DoubleNullable { get; set; } + + public sbyte SByte { get; set; } + public sbyte? SByteNullable { get; set; } + + public short Short { get; set; } + public short? ShortNullable { get; set; } + + public byte Byte { get; set; } + public byte? ByteNullable { get; set; } + + public long Long { get; set; } + public long? LongNullable { get; set; } + + public uint Uint { get; set; } + public uint? UintNullable { get; set; } + + public TimeSpan TimeSpan { get; set; } + public TimeSpan? TimeSpanNullable { get; set; } + + public decimal Decimal { get; set; } + public decimal? DecimalNullable { get; set; } + + public ulong Ulong { get; set; } + public ulong? UlongNullable { get; set; } + + public DateTime DateTime { get; set; } + public DateTime? DateTimeNullable { get; set; } + + public DateTimeOffset DateTimeOffset { get; set; } + public DateTimeOffset? DateTimeOffsetNullable { get; set; } + + public bool Bool { get; set; } + public bool? BoolNullable { get; set; } + + public char Char { get; set; } + public char? CharNullable { get; set; } + + public Guid Guid { get; set; } + public Guid? GuidNullable { get; set; } + + public string String { get; set; } + + } + + protected override object ExpectJson => new + { + properties = new + { + @bool = new { type = "boolean" }, + boolNullable = new { type = "boolean" }, + @byte = new { type = "short" }, + byteNullable = new { type = "short" }, + @char = new { type = "keyword" }, + charNullable = new { type = "keyword" }, + dateTime = new { type = "date" }, + dateTimeNullable = new { type = "date" }, + dateTimeOffset = new { type = "date" }, + dateTimeOffsetNullable = new { type = "date" }, + @decimal = new { type = "double" }, + decimalNullable = new { type = "double" }, + @double = new { type = "double" }, + doubleNullable = new { type = "double" }, + @float = new { type = "float" }, + floatNullable = new { type = "float" }, + guid = new { type = "keyword" }, + guidNullable = new { type = "keyword" }, + @int = new { type = "integer" }, + intNullable = new { type = "integer" }, + @long = new { type = "long" }, + longNullable = new { type = "long" }, + sByte = new { type = "byte" }, + sByteNullable = new { type = "byte" }, + @short = new { type = "short" }, + shortNullable = new { type = "short" }, + @string = new { type = "text" }, + timeSpan = new { type = "long" }, + timeSpanNullable = new { type = "long" }, + @uint = new { type = "long" }, + uintNullable = new { type = "long" }, + @ulong = new { type = "double" }, + ulongNullable = new { type = "double" } + } + }; + + protected override Func, ITypeMapping> Fluent => f => f + .Properties(ps => ps + .Scalar(p => p.Int, m => m) + .Scalar(p => p.IntNullable, m => m) + .Scalar(p => p.Float, m => m) + .Scalar(p => p.FloatNullable, m => m) + .Scalar(p => p.Double, m => m) + .Scalar(p => p.DoubleNullable, m => m) + .Scalar(p => p.SByte, m => m) + .Scalar(p => p.SByteNullable, m => m) + .Scalar(p => p.Short, m => m) + .Scalar(p => p.ShortNullable, m => m) + .Scalar(p => p.Byte, m => m) + .Scalar(p => p.ByteNullable, m => m) + .Scalar(p => p.Long, m => m) + .Scalar(p => p.LongNullable, m => m) + .Scalar(p => p.Uint, m => m) + .Scalar(p => p.UintNullable, m => m) + .Scalar(p => p.TimeSpan, m => m) + .Scalar(p => p.TimeSpanNullable, m => m) + .Scalar(p => p.Decimal, m => m) + .Scalar(p => p.DecimalNullable, m => m) + .Scalar(p => p.Ulong, m => m) + .Scalar(p => p.UlongNullable, m => m) + .Scalar(p => p.DateTime, m => m) + .Scalar(p => p.DateTimeNullable, m => m) + .Scalar(p => p.DateTimeOffset, m => m) + .Scalar(p => p.DateTimeOffsetNullable, m => m) + .Scalar(p => p.Bool, m => m) + .Scalar(p => p.BoolNullable, m => m) + .Scalar(p => p.Char, m => m) + .Scalar(p => p.CharNullable, m => m) + .Scalar(p => p.Guid, m => m) + .Scalar(p => p.GuidNullable, m => m) + .Scalar(p => p.String, m => m) + ); + + protected override TypeMapping Initializer => null; + } +} diff --git a/src/Tests/Tests.csproj b/src/Tests/Tests.csproj index 391e37da707..f55b821208c 100644 --- a/src/Tests/Tests.csproj +++ b/src/Tests/Tests.csproj @@ -348,6 +348,7 @@ + diff --git a/src/Tests/tests.yaml b/src/Tests/tests.yaml index 6fc7c370378..825accf5dd5 100644 --- a/src/Tests/tests.yaml +++ b/src/Tests/tests.yaml @@ -1,5 +1,5 @@ # mode either u (unit test), i (integration test) or m (mixed mode) -mode: m +mode: u # the elasticsearch version that should be started # Can be a snapshot version of sonatype or "latest" to get the latest snapshot of sonatype elasticsearch_version: 5.0.0-beta1 From 0bd986d06a43d4834cf79112b4a0881ba318d3c4 Mon Sep 17 00:00:00 2001 From: Mpdreamz Date: Thu, 10 Nov 2016 10:09:08 +0100 Subject: [PATCH 2/4] remove compiler warnings --- src/Nest/Mapping/DynamicTemplate/SingleMapping.cs | 4 +++- src/Nest/Mapping/Types/Properties-Scalar.cs | 4 ++++ src/Nest/Mapping/Types/Properties.cs | 4 ++-- src/Tests/Mapping/Scalar/ScalarUsageTests.cs | 1 - 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Nest/Mapping/DynamicTemplate/SingleMapping.cs b/src/Nest/Mapping/DynamicTemplate/SingleMapping.cs index 484dd40a47b..34912190dd9 100644 --- a/src/Nest/Mapping/DynamicTemplate/SingleMapping.cs +++ b/src/Nest/Mapping/DynamicTemplate/SingleMapping.cs @@ -19,7 +19,7 @@ public IProperty Keyword(Func, IKeywordProperty> se /// /// Number introduces a numeric mapping that defaults to `float` use .Type() to set the right type if needed or use - /// instead of + /// Scalar instead of /// public IProperty Number(Func, INumberProperty> selector) => selector?.Invoke(new NumberPropertyDescriptor()); @@ -68,6 +68,7 @@ public IProperty Percolator(Func, IPercolatorPro +#pragma warning disable CS3001 // Argument type is not CLS-compliant public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Integer)); @@ -166,5 +167,6 @@ public IProperty Scalar(Expression> field, Func> field, Func, ITextProperty> selector) => selector?.InvokeOrDefault(new TextPropertyDescriptor().Name(field)); +#pragma warning restore CS3001 // Argument type is not CLS-compliant } } diff --git a/src/Nest/Mapping/Types/Properties-Scalar.cs b/src/Nest/Mapping/Types/Properties-Scalar.cs index 53de99e48a8..42449e07ef4 100644 --- a/src/Nest/Mapping/Types/Properties-Scalar.cs +++ b/src/Nest/Mapping/Types/Properties-Scalar.cs @@ -10,6 +10,7 @@ public partial interface IPropertiesDescriptor where T : class where TReturnType : class { +#pragma warning disable CS3001 // Argument type is not CLS-compliant TReturnType Scalar(Expression> field, Func, INumberProperty> selector); TReturnType Scalar(Expression> field, Func, INumberProperty> selector); @@ -75,11 +76,13 @@ public partial interface IPropertiesDescriptor TReturnType Scalar(Expression> field, Func, IKeywordProperty> selector); TReturnType Scalar(Expression> field, Func, ITextProperty> selector); +#pragma warning restore CS3001 // Argument type is not CLS-compliant } public partial class PropertiesDescriptor : IsADictionaryDescriptorBase, IProperties, PropertyName, IProperty>, IPropertiesDescriptor> where T : class { +#pragma warning disable CS3001 // Argument type is not CLS-compliant public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Integer))); @@ -178,6 +181,7 @@ public PropertiesDescriptor Scalar(Expression> field, Func Scalar(Expression> field, Func, ITextProperty> selector) => SetProperty(selector?.InvokeOrDefault(new TextPropertyDescriptor().Name(field))); +#pragma warning restore CS3001 // Argument type is not CLS-compliant } } diff --git a/src/Nest/Mapping/Types/Properties.cs b/src/Nest/Mapping/Types/Properties.cs index af3ad24085b..56b1534c043 100644 --- a/src/Nest/Mapping/Types/Properties.cs +++ b/src/Nest/Mapping/Types/Properties.cs @@ -44,7 +44,7 @@ public partial interface IPropertiesDescriptor TReturnType Keyword(Func, IKeywordProperty> selector); /// /// Number introduces a numeric mapping that defaults to `float` use .Type() to set the right type if needed or use - /// instead of + /// Scalar instead of /// TReturnType Number(Func, INumberProperty> selector); TReturnType TokenCount(Func, ITokenCountProperty> selector); @@ -80,7 +80,7 @@ public PropertiesDescriptor() : base(new Properties()) { } /// /// Number introduces a numeric mapping that defaults to `float` use .Type() to set the right type if needed or use - /// instead of + /// Scalar instead of /// public PropertiesDescriptor Number(Func, INumberProperty> selector) => SetProperty(selector); diff --git a/src/Tests/Mapping/Scalar/ScalarUsageTests.cs b/src/Tests/Mapping/Scalar/ScalarUsageTests.cs index a785e33679c..6cb50f4b080 100644 --- a/src/Tests/Mapping/Scalar/ScalarUsageTests.cs +++ b/src/Tests/Mapping/Scalar/ScalarUsageTests.cs @@ -65,7 +65,6 @@ public class ScalarPoco public Guid? GuidNullable { get; set; } public string String { get; set; } - } protected override object ExpectJson => new From 71c2990dafa1405e06729ca4f0d033b5a4365a36 Mon Sep 17 00:00:00 2001 From: Greg Marzouka Date: Fri, 11 Nov 2016 14:50:42 -0500 Subject: [PATCH 3/4] Add IEnumerable overloads --- .../Mapping/DynamicTemplate/SingleMapping.cs | 86 ++++++++--- src/Nest/Mapping/Types/Properties-Scalar.cs | 133 +++++++++++++----- src/Tests/Mapping/Scalar/ScalarUsageTests.cs | 103 +++++++++++++- 3 files changed, 269 insertions(+), 53 deletions(-) diff --git a/src/Nest/Mapping/DynamicTemplate/SingleMapping.cs b/src/Nest/Mapping/DynamicTemplate/SingleMapping.cs index 34912190dd9..adef2bfebab 100644 --- a/src/Nest/Mapping/DynamicTemplate/SingleMapping.cs +++ b/src/Nest/Mapping/DynamicTemplate/SingleMapping.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Linq.Expressions; namespace Nest @@ -66,107 +67,156 @@ public IProperty Generic(Func, IGenericProperty> se public IProperty Percolator(Func, IPercolatorProperty> selector) => selector?.Invoke(new PercolatorPropertyDescriptor()); - - #pragma warning disable CS3001 // Argument type is not CLS-compliant public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Integer)); - + public IProperty Scalar(Expression>> field, Func, INumberProperty> selector) => + selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Integer)); public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Integer)); + public IProperty Scalar(Expression>> field, Func, INumberProperty> selector) => + selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Integer)); public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Float)); - + public IProperty Scalar(Expression>> field, Func, INumberProperty> selector) => + selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Float)); public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Float)); + public IProperty Scalar(Expression>> field, Func, INumberProperty> selector) => + selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Float)); public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Byte)); - public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Byte)); + public IProperty Scalar(Expression>> field, Func, INumberProperty> selector) => + selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Byte)); + public IProperty Scalar(Expression>> field, Func, INumberProperty> selector) => + selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Byte)); public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short)); - public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short)); + public IProperty Scalar(Expression>> field, Func, INumberProperty> selector) => + selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short)); + public IProperty Scalar(Expression>> field, Func, INumberProperty> selector) => + selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short)); public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short)); - public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short)); + public IProperty Scalar(Expression>> field, Func, INumberProperty> selector) => + selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short)); + public IProperty Scalar(Expression>> field, Func, INumberProperty> selector) => + selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short)); public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long)); - public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long)); + public IProperty Scalar(Expression>> field, Func, INumberProperty> selector) => + selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long)); + public IProperty Scalar(Expression>> field, Func, INumberProperty> selector) => + selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long)); public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long)); - public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long)); + public IProperty Scalar(Expression>> field, Func, INumberProperty> selector) => + selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long)); + public IProperty Scalar(Expression>> field, Func, INumberProperty> selector) => + selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long)); public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long)); - public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long)); + public IProperty Scalar(Expression>> field, Func, INumberProperty> selector) => + selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long)); + public IProperty Scalar(Expression>> field, Func, INumberProperty> selector) => + selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long)); public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double)); - public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double)); + public IProperty Scalar(Expression>> field, Func, INumberProperty> selector) => + selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double)); + public IProperty Scalar(Expression>> field, Func, INumberProperty> selector) => + selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double)); public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double)); - public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double)); + public IProperty Scalar(Expression>> field, Func, INumberProperty> selector) => + selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double)); + public IProperty Scalar(Expression>> field, Func, INumberProperty> selector) => + selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double)); public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double)); - public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double)); + public IProperty Scalar(Expression>> field, Func, INumberProperty> selector) => + selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double)); + public IProperty Scalar(Expression>> field, Func, INumberProperty> selector) => + selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double)); public IProperty Scalar(Expression> field, Func, IDateProperty> selector) => selector?.InvokeOrDefault(new DatePropertyDescriptor().Name(field)); - public IProperty Scalar(Expression> field, Func, IDateProperty> selector) => selector?.InvokeOrDefault(new DatePropertyDescriptor().Name(field)); + public IProperty Scalar(Expression>> field, Func, IDateProperty> selector) => + selector?.InvokeOrDefault(new DatePropertyDescriptor().Name(field)); + public IProperty Scalar(Expression>> field, Func, IDateProperty> selector) => + selector?.InvokeOrDefault(new DatePropertyDescriptor().Name(field)); public IProperty Scalar(Expression> field, Func, IDateProperty> selector) => selector?.InvokeOrDefault(new DatePropertyDescriptor().Name(field)); - public IProperty Scalar(Expression> field, Func, IDateProperty> selector) => selector?.InvokeOrDefault(new DatePropertyDescriptor().Name(field)); + public IProperty Scalar(Expression>> field, Func, IDateProperty> selector) => + selector?.InvokeOrDefault(new DatePropertyDescriptor().Name(field)); + public IProperty Scalar(Expression>> field, Func, IDateProperty> selector) => + selector?.InvokeOrDefault(new DatePropertyDescriptor().Name(field)); public IProperty Scalar(Expression> field, Func, IBooleanProperty> selector) => selector?.InvokeOrDefault(new BooleanPropertyDescriptor().Name(field)); - public IProperty Scalar(Expression> field, Func, IBooleanProperty> selector) => selector?.InvokeOrDefault(new BooleanPropertyDescriptor().Name(field)); + public IProperty Scalar(Expression>> field, Func, IBooleanProperty> selector) => + selector?.InvokeOrDefault(new BooleanPropertyDescriptor().Name(field)); + public IProperty Scalar(Expression>> field, Func, IBooleanProperty> selector) => + selector?.InvokeOrDefault(new BooleanPropertyDescriptor().Name(field)); public IProperty Scalar(Expression> field, Func, IKeywordProperty> selector) => selector?.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field)); - public IProperty Scalar(Expression> field, Func, IKeywordProperty> selector) => selector?.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field)); + public IProperty Scalar(Expression>> field, Func, IKeywordProperty> selector) => + selector?.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field)); + public IProperty Scalar(Expression>> field, Func, IKeywordProperty> selector) => + selector?.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field)); public IProperty Scalar(Expression> field, Func, IKeywordProperty> selector) => selector?.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field)); - public IProperty Scalar(Expression> field, Func, IKeywordProperty> selector) => selector?.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field)); + public IProperty Scalar(Expression>> field, Func, IKeywordProperty> selector) => + selector?.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field)); + public IProperty Scalar(Expression>> field, Func, IKeywordProperty> selector) => + selector?.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field)); + public IProperty Scalar(Expression> field, Func, ITextProperty> selector) => selector?.InvokeOrDefault(new TextPropertyDescriptor().Name(field)); + public IProperty Scalar(Expression>> field, Func, ITextProperty> selector) => + selector?.InvokeOrDefault(new TextPropertyDescriptor().Name(field)); #pragma warning restore CS3001 // Argument type is not CLS-compliant } } diff --git a/src/Nest/Mapping/Types/Properties-Scalar.cs b/src/Nest/Mapping/Types/Properties-Scalar.cs index 42449e07ef4..56de3f2dd4c 100644 --- a/src/Nest/Mapping/Types/Properties-Scalar.cs +++ b/src/Nest/Mapping/Types/Properties-Scalar.cs @@ -12,70 +12,87 @@ public partial interface IPropertiesDescriptor { #pragma warning disable CS3001 // Argument type is not CLS-compliant TReturnType Scalar(Expression> field, Func, INumberProperty> selector); - TReturnType Scalar(Expression> field, Func, INumberProperty> selector); + TReturnType Scalar(Expression>> field, Func, INumberProperty> selector); + TReturnType Scalar(Expression>> field, Func, INumberProperty> selector); TReturnType Scalar(Expression> field, Func, INumberProperty> selector); - TReturnType Scalar(Expression> field, Func, INumberProperty> selector); + TReturnType Scalar(Expression>> field, Func, INumberProperty> selector); + TReturnType Scalar(Expression>> field, Func, INumberProperty> selector); TReturnType Scalar(Expression> field, Func, INumberProperty> selector); - TReturnType Scalar(Expression> field, Func, INumberProperty> selector); + TReturnType Scalar(Expression>> field, Func, INumberProperty> selector); + TReturnType Scalar(Expression>> field, Func, INumberProperty> selector); TReturnType Scalar(Expression> field, Func, INumberProperty> selector); - TReturnType Scalar(Expression> field, Func, INumberProperty> selector); + TReturnType Scalar(Expression>> field, Func, INumberProperty> selector); + TReturnType Scalar(Expression>> field, Func, INumberProperty> selector); TReturnType Scalar(Expression> field, Func, INumberProperty> selector); - TReturnType Scalar(Expression> field, Func, INumberProperty> selector); + TReturnType Scalar(Expression>> field, Func, INumberProperty> selector); + TReturnType Scalar(Expression>> field, Func, INumberProperty> selector); TReturnType Scalar(Expression> field, Func, INumberProperty> selector); - TReturnType Scalar(Expression> field, Func, INumberProperty> selector); + TReturnType Scalar(Expression>> field, Func, INumberProperty> selector); + TReturnType Scalar(Expression>> field, Func, INumberProperty> selector); TReturnType Scalar(Expression> field, Func, INumberProperty> selector); - TReturnType Scalar(Expression> field, Func, INumberProperty> selector); + TReturnType Scalar(Expression>> field, Func, INumberProperty> selector); + TReturnType Scalar(Expression>> field, Func, INumberProperty> selector); TReturnType Scalar(Expression> field, Func, INumberProperty> selector); - TReturnType Scalar(Expression> field, Func, INumberProperty> selector); + TReturnType Scalar(Expression>> field, Func, INumberProperty> selector); + TReturnType Scalar(Expression>> field, Func, INumberProperty> selector); TReturnType Scalar(Expression> field, Func, INumberProperty> selector); - TReturnType Scalar(Expression> field, Func, INumberProperty> selector); + TReturnType Scalar(Expression>> field, Func, INumberProperty> selector); + TReturnType Scalar(Expression>> field, Func, INumberProperty> selector); TReturnType Scalar(Expression> field, Func, INumberProperty> selector); - TReturnType Scalar(Expression> field, Func, INumberProperty> selector); + TReturnType Scalar(Expression>> field, Func, INumberProperty> selector); + TReturnType Scalar(Expression>> field, Func, INumberProperty> selector); TReturnType Scalar(Expression> field, Func, INumberProperty> selector); - TReturnType Scalar(Expression> field, Func, INumberProperty> selector); + TReturnType Scalar(Expression>> field, Func, INumberProperty> selector); + TReturnType Scalar(Expression>> field, Func, INumberProperty> selector); TReturnType Scalar(Expression> field, Func, IDateProperty> selector); - TReturnType Scalar(Expression> field, Func, IDateProperty> selector); + TReturnType Scalar(Expression>> field, Func, IDateProperty> selector); + TReturnType Scalar(Expression>> field, Func, IDateProperty> selector); TReturnType Scalar(Expression> field, Func, IDateProperty> selector); - TReturnType Scalar(Expression> field, Func, IDateProperty> selector); + TReturnType Scalar(Expression>> field, Func, IDateProperty> selector); + TReturnType Scalar(Expression>> field, Func, IDateProperty> selector); TReturnType Scalar(Expression> field, Func, IBooleanProperty> selector); - TReturnType Scalar(Expression> field, Func, IBooleanProperty> selector); + TReturnType Scalar(Expression>> field, Func, IBooleanProperty> selector); + TReturnType Scalar(Expression>> field, Func, IBooleanProperty> selector); TReturnType Scalar(Expression> field, Func, IKeywordProperty> selector); - TReturnType Scalar(Expression> field, Func, IKeywordProperty> selector); + TReturnType Scalar(Expression>> field, Func, IKeywordProperty> selector); + TReturnType Scalar(Expression>> field, Func, IKeywordProperty> selector); TReturnType Scalar(Expression> field, Func, IKeywordProperty> selector); - TReturnType Scalar(Expression> field, Func, IKeywordProperty> selector); + TReturnType Scalar(Expression>> field, Func, IKeywordProperty> selector); + TReturnType Scalar(Expression>> field, Func, IKeywordProperty> selector); TReturnType Scalar(Expression> field, Func, ITextProperty> selector); + TReturnType Scalar(Expression>> field, Func, ITextProperty> selector); #pragma warning restore CS3001 // Argument type is not CLS-compliant } @@ -85,103 +102,153 @@ public partial class PropertiesDescriptor : IsADictionaryDescriptorBase Scalar(Expression> field, Func, INumberProperty> selector) => SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Integer))); - + public PropertiesDescriptor Scalar(Expression>> field, Func, INumberProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Integer))); public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Integer))); + public PropertiesDescriptor Scalar(Expression>> field, Func, INumberProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Integer))); public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Float))); - + public PropertiesDescriptor Scalar(Expression>> field, Func, INumberProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Float))); public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Float))); + public PropertiesDescriptor Scalar(Expression>> field, Func, INumberProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Float))); public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Byte))); - public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Byte))); + public PropertiesDescriptor Scalar(Expression>> field, Func, INumberProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Byte))); + public PropertiesDescriptor Scalar(Expression>> field, Func, INumberProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Byte))); public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short))); - public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short))); + public PropertiesDescriptor Scalar(Expression>> field, Func, INumberProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short))); + public PropertiesDescriptor Scalar(Expression>> field, Func, INumberProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short))); public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short))); - public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short))); + public PropertiesDescriptor Scalar(Expression>> field, Func, INumberProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short))); + public PropertiesDescriptor Scalar(Expression>> field, Func, INumberProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short))); public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long))); - public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long))); + public PropertiesDescriptor Scalar(Expression>> field, Func, INumberProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long))); + public PropertiesDescriptor Scalar(Expression>> field, Func, INumberProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long))); public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long))); - public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long))); + public PropertiesDescriptor Scalar(Expression>> field, Func, INumberProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long))); + public PropertiesDescriptor Scalar(Expression>> field, Func, INumberProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long))); public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long))); - public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long))); + public PropertiesDescriptor Scalar(Expression>> field, Func, INumberProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long))); + public PropertiesDescriptor Scalar(Expression>> field, Func, INumberProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long))); public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double))); - public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double))); + public PropertiesDescriptor Scalar(Expression>> field, Func, INumberProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double))); + public PropertiesDescriptor Scalar(Expression>> field, Func, INumberProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double))); public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double))); - public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double))); + public PropertiesDescriptor Scalar(Expression>> field, Func, INumberProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double))); + public PropertiesDescriptor Scalar(Expression>> field, Func, INumberProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double))); public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double))); - public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double))); + public PropertiesDescriptor Scalar(Expression>> field, Func, INumberProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double))); + public PropertiesDescriptor Scalar(Expression>> field, Func, INumberProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double))); public PropertiesDescriptor Scalar(Expression> field, Func, IDateProperty> selector) => SetProperty(selector?.InvokeOrDefault(new DatePropertyDescriptor().Name(field))); - public PropertiesDescriptor Scalar(Expression> field, Func, IDateProperty> selector) => SetProperty(selector?.InvokeOrDefault(new DatePropertyDescriptor().Name(field))); + public PropertiesDescriptor Scalar(Expression>> field, Func, IDateProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new DatePropertyDescriptor().Name(field))); + public PropertiesDescriptor Scalar(Expression>> field, Func, IDateProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new DatePropertyDescriptor().Name(field))); public PropertiesDescriptor Scalar(Expression> field, Func, IDateProperty> selector) => SetProperty(selector?.InvokeOrDefault(new DatePropertyDescriptor().Name(field))); - public PropertiesDescriptor Scalar(Expression> field, Func, IDateProperty> selector) => SetProperty(selector?.InvokeOrDefault(new DatePropertyDescriptor().Name(field))); + public PropertiesDescriptor Scalar(Expression>> field, Func, IDateProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new DatePropertyDescriptor().Name(field))); + public PropertiesDescriptor Scalar(Expression>> field, Func, IDateProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new DatePropertyDescriptor().Name(field))); public PropertiesDescriptor Scalar(Expression> field, Func, IBooleanProperty> selector) => SetProperty(selector?.InvokeOrDefault(new BooleanPropertyDescriptor().Name(field))); - public PropertiesDescriptor Scalar(Expression> field, Func, IBooleanProperty> selector) => SetProperty(selector?.InvokeOrDefault(new BooleanPropertyDescriptor().Name(field))); + public PropertiesDescriptor Scalar(Expression>> field, Func, IBooleanProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new BooleanPropertyDescriptor().Name(field))); + public PropertiesDescriptor Scalar(Expression>> field, Func, IBooleanProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new BooleanPropertyDescriptor().Name(field))); public PropertiesDescriptor Scalar(Expression> field, Func, IKeywordProperty> selector) => SetProperty(selector?.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field))); - public PropertiesDescriptor Scalar(Expression> field, Func, IKeywordProperty> selector) => SetProperty(selector?.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field))); + public PropertiesDescriptor Scalar(Expression>> field, Func, IKeywordProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field))); + public PropertiesDescriptor Scalar(Expression>> field, Func, IKeywordProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field))); public PropertiesDescriptor Scalar(Expression> field, Func, IKeywordProperty> selector) => SetProperty(selector?.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field))); - public PropertiesDescriptor Scalar(Expression> field, Func, IKeywordProperty> selector) => SetProperty(selector?.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field))); + public PropertiesDescriptor Scalar(Expression>> field, Func, IKeywordProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field))); + public PropertiesDescriptor Scalar(Expression>> field, Func, IKeywordProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field))); + public PropertiesDescriptor Scalar(Expression> field, Func, ITextProperty> selector) => SetProperty(selector?.InvokeOrDefault(new TextPropertyDescriptor().Name(field))); + public PropertiesDescriptor Scalar(Expression>> field, Func, ITextProperty> selector) => + SetProperty(selector?.InvokeOrDefault(new TextPropertyDescriptor().Name(field))); #pragma warning restore CS3001 // Argument type is not CLS-compliant - } } diff --git a/src/Tests/Mapping/Scalar/ScalarUsageTests.cs b/src/Tests/Mapping/Scalar/ScalarUsageTests.cs index 6cb50f4b080..9b68c1b7fa3 100644 --- a/src/Tests/Mapping/Scalar/ScalarUsageTests.cs +++ b/src/Tests/Mapping/Scalar/ScalarUsageTests.cs @@ -17,54 +17,87 @@ public class ScalarUsageTests : UsageTestBase Ints { get; set; } public int? IntNullable { get; set; } + public IEnumerable IntNullables { get; set; } public float Float { get; set; } + public IEnumerable Floats { get; set; } public float? FloatNullable { get; set; } + public IEnumerable FloatNullables { get; set; } public double Double { get; set; } + public IEnumerable Doubles { get; set; } public double? DoubleNullable { get; set; } + public IEnumerable DoubleNullables { get; set; } public sbyte SByte { get; set; } + public IEnumerable SBytes { get; set; } public sbyte? SByteNullable { get; set; } + public IEnumerable SByteNullables { get; set; } public short Short { get; set; } + public IEnumerable Shorts { get; set; } public short? ShortNullable { get; set; } + public IEnumerable ShortNullables { get; set; } public byte Byte { get; set; } + public IEnumerable Bytes { get; set; } public byte? ByteNullable { get; set; } + public IEnumerable ByteNullables { get; set; } public long Long { get; set; } + public IEnumerable Longs { get; set; } public long? LongNullable { get; set; } + public IEnumerable LongNullables { get; set; } public uint Uint { get; set; } + public IEnumerable Uints { get; set; } public uint? UintNullable { get; set; } + public IEnumerable UintNullables { get; set; } public TimeSpan TimeSpan { get; set; } + public IEnumerable TimeSpans { get; set; } public TimeSpan? TimeSpanNullable { get; set; } + public IEnumerable TimeSpanNullables { get; set; } public decimal Decimal { get; set; } + public IEnumerable Decimals {get;set; } public decimal? DecimalNullable { get; set; } + public IEnumerable DecimalNullables { get; set; } public ulong Ulong { get; set; } + public IEnumerable Ulongs { get; set; } public ulong? UlongNullable { get; set; } + public IEnumerable UlongNullables { get; set; } public DateTime DateTime { get; set; } + public IEnumerable DateTimes { get; set; } public DateTime? DateTimeNullable { get; set; } + public IEnumerable DateTimeNullables { get; set; } public DateTimeOffset DateTimeOffset { get; set; } + public IEnumerable DateTimeOffsets { get; set; } public DateTimeOffset? DateTimeOffsetNullable { get; set; } + public IEnumerable DateTimeOffsetNullables { get; set; } public bool Bool { get; set; } + public IEnumerable Bools { get; set; } public bool? BoolNullable { get; set; } + public IEnumerable BoolNullables { get; set; } public char Char { get; set; } + public IEnumerable Chars { get; set; } public char? CharNullable { get; set; } + public IEnumerable CharNullables { get; set; } public Guid Guid { get; set; } + public IEnumerable Guids { get; set; } public Guid? GuidNullable { get; set; } + public IEnumerable GuidNullables { get; set; } public string String { get; set; } + public IEnumerable Strings { get; set; } } protected override object ExpectJson => new @@ -72,76 +105,142 @@ public class ScalarPoco properties = new { @bool = new { type = "boolean" }, + bools = new { type = "boolean" }, boolNullable = new { type = "boolean" }, + boolNullables = new { type = "boolean" }, @byte = new { type = "short" }, + bytes = new { type = "short" }, byteNullable = new { type = "short" }, + byteNullables = new { type = "short" }, @char = new { type = "keyword" }, + chars = new { type = "keyword" }, charNullable = new { type = "keyword" }, + charNullables = new { type = "keyword" }, dateTime = new { type = "date" }, + dateTimes = new { type = "date" }, dateTimeNullable = new { type = "date" }, + dateTimeNullables = new { type = "date" }, dateTimeOffset = new { type = "date" }, + dateTimeOffsets = new { type = "date" }, dateTimeOffsetNullable = new { type = "date" }, + dateTimeOffsetNullables = new { type = "date" }, @decimal = new { type = "double" }, + decimals = new { type = "double" }, decimalNullable = new { type = "double" }, + decimalNullables = new { type = "double" }, @double = new { type = "double" }, + doubles = new { type = "double" }, doubleNullable = new { type = "double" }, + doubleNullables = new { type = "double" }, @float = new { type = "float" }, + floats = new { type = "float" }, floatNullable = new { type = "float" }, + floatNullables = new { type = "float" }, guid = new { type = "keyword" }, + guids = new { type = "keyword" }, guidNullable = new { type = "keyword" }, + guidNullables = new { type = "keyword" }, @int = new { type = "integer" }, + ints = new { type = "integer" }, intNullable = new { type = "integer" }, + intNullables = new { type = "integer" }, @long = new { type = "long" }, + longs = new { type = "long" }, longNullable = new { type = "long" }, + longNullables = new { type = "long" }, sByte = new { type = "byte" }, + sBytes = new { type = "byte" }, sByteNullable = new { type = "byte" }, + sByteNullables = new { type = "byte" }, @short = new { type = "short" }, + shorts = new { type = "short" }, shortNullable = new { type = "short" }, - @string = new { type = "text" }, + shortNullables = new { type = "short" }, timeSpan = new { type = "long" }, + timeSpans = new { type = "long" }, timeSpanNullable = new { type = "long" }, + timeSpanNullables = new { type = "long" }, @uint = new { type = "long" }, + uints = new { type = "long" }, uintNullable = new { type = "long" }, + uintNullables = new { type = "long" }, @ulong = new { type = "double" }, - ulongNullable = new { type = "double" } + ulongs = new { type = "double" }, + ulongNullable = new { type = "double" }, + ulongNullables = new { type = "double" }, + @string = new { type = "text" }, + strings = new { type = "text" } } }; protected override Func, ITypeMapping> Fluent => f => f .Properties(ps => ps .Scalar(p => p.Int, m => m) + .Scalar(p => p.Ints, m => m) .Scalar(p => p.IntNullable, m => m) + .Scalar(p => p.IntNullables, m => m) .Scalar(p => p.Float, m => m) + .Scalar(p => p.Floats, m => m) .Scalar(p => p.FloatNullable, m => m) + .Scalar(p => p.FloatNullables, m => m) .Scalar(p => p.Double, m => m) + .Scalar(p => p.Doubles, m => m) .Scalar(p => p.DoubleNullable, m => m) + .Scalar(p => p.DoubleNullables, m => m) .Scalar(p => p.SByte, m => m) + .Scalar(p => p.SBytes, m => m) .Scalar(p => p.SByteNullable, m => m) + .Scalar(p => p.SByteNullables, m => m) .Scalar(p => p.Short, m => m) + .Scalar(p => p.Shorts, m => m) .Scalar(p => p.ShortNullable, m => m) + .Scalar(p => p.ShortNullables, m => m) .Scalar(p => p.Byte, m => m) + .Scalar(p => p.Bytes, m => m) .Scalar(p => p.ByteNullable, m => m) + .Scalar(p => p.ByteNullables, m => m) .Scalar(p => p.Long, m => m) + .Scalar(p => p.Longs, m => m) .Scalar(p => p.LongNullable, m => m) + .Scalar(p => p.LongNullables, m => m) .Scalar(p => p.Uint, m => m) + .Scalar(p => p.Uints, m => m) .Scalar(p => p.UintNullable, m => m) + .Scalar(p => p.UintNullables, m => m) .Scalar(p => p.TimeSpan, m => m) + .Scalar(p => p.TimeSpans, m => m) .Scalar(p => p.TimeSpanNullable, m => m) + .Scalar(p => p.TimeSpanNullables, m => m) .Scalar(p => p.Decimal, m => m) + .Scalar(p => p.Decimals, m => m) .Scalar(p => p.DecimalNullable, m => m) + .Scalar(p => p.DecimalNullables, m => m) .Scalar(p => p.Ulong, m => m) + .Scalar(p => p.Ulongs, m => m) .Scalar(p => p.UlongNullable, m => m) + .Scalar(p => p.UlongNullables, m => m) .Scalar(p => p.DateTime, m => m) + .Scalar(p => p.DateTimes, m => m) .Scalar(p => p.DateTimeNullable, m => m) + .Scalar(p => p.DateTimeNullables, m => m) .Scalar(p => p.DateTimeOffset, m => m) + .Scalar(p => p.DateTimeOffsets, m => m) .Scalar(p => p.DateTimeOffsetNullable, m => m) + .Scalar(p => p.DateTimeOffsetNullables, m => m) .Scalar(p => p.Bool, m => m) + .Scalar(p => p.Bools, m => m) .Scalar(p => p.BoolNullable, m => m) + .Scalar(p => p.BoolNullables, m => m) .Scalar(p => p.Char, m => m) + .Scalar(p => p.Chars, m => m) .Scalar(p => p.CharNullable, m => m) + .Scalar(p => p.CharNullables, m => m) .Scalar(p => p.Guid, m => m) + .Scalar(p => p.Guids, m => m) .Scalar(p => p.GuidNullable, m => m) + .Scalar(p => p.GuidNullables, m => m) .Scalar(p => p.String, m => m) + .Scalar(p => p.Strings, m => m) ); protected override TypeMapping Initializer => null; From 6a06ee0a2898e17c9738af98f9babb2b7871c72c Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Fri, 18 Nov 2016 12:50:19 +0100 Subject: [PATCH 4/4] selector?.InvokeOrDefault => selector.InvokeOrDefault --- .../Mapping/DynamicTemplate/SingleMapping.cs | 134 +++++++++--------- src/Nest/Mapping/Types/Properties-Scalar.cs | 132 ++++++++--------- 2 files changed, 133 insertions(+), 133 deletions(-) diff --git a/src/Nest/Mapping/DynamicTemplate/SingleMapping.cs b/src/Nest/Mapping/DynamicTemplate/SingleMapping.cs index adef2bfebab..5b6590cebfc 100644 --- a/src/Nest/Mapping/DynamicTemplate/SingleMapping.cs +++ b/src/Nest/Mapping/DynamicTemplate/SingleMapping.cs @@ -33,7 +33,7 @@ public IProperty Boolean(Func, IBooleanProperty> se public IProperty Binary(Func, IBinaryProperty> selector) => selector?.Invoke(new BinaryPropertyDescriptor()); - + / public IProperty Attachment(Func, IAttachmentProperty> selector) => selector?.Invoke(new AttachmentPropertyDescriptor()); @@ -69,154 +69,154 @@ public IProperty Percolator(Func, IPercolatorPro #pragma warning disable CS3001 // Argument type is not CLS-compliant public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => - selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Integer)); + selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Integer)); public IProperty Scalar(Expression>> field, Func, INumberProperty> selector) => - selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Integer)); + selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Integer)); public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => - selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Integer)); + selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Integer)); public IProperty Scalar(Expression>> field, Func, INumberProperty> selector) => - selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Integer)); + selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Integer)); public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => - selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Float)); + selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Float)); public IProperty Scalar(Expression>> field, Func, INumberProperty> selector) => - selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Float)); + selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Float)); public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => - selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Float)); + selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Float)); public IProperty Scalar(Expression>> field, Func, INumberProperty> selector) => - selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Float)); + selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Float)); public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => - selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Byte)); + selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Byte)); public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => - selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Byte)); + selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Byte)); public IProperty Scalar(Expression>> field, Func, INumberProperty> selector) => - selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Byte)); + selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Byte)); public IProperty Scalar(Expression>> field, Func, INumberProperty> selector) => - selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Byte)); + selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Byte)); public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => - selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short)); + selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short)); public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => - selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short)); + selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short)); public IProperty Scalar(Expression>> field, Func, INumberProperty> selector) => - selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short)); + selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short)); public IProperty Scalar(Expression>> field, Func, INumberProperty> selector) => - selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short)); + selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short)); public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => - selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short)); + selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short)); public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => - selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short)); + selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short)); public IProperty Scalar(Expression>> field, Func, INumberProperty> selector) => - selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short)); + selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short)); public IProperty Scalar(Expression>> field, Func, INumberProperty> selector) => - selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short)); + selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short)); public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => - selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long)); + selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long)); public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => - selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long)); + selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long)); public IProperty Scalar(Expression>> field, Func, INumberProperty> selector) => - selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long)); + selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long)); public IProperty Scalar(Expression>> field, Func, INumberProperty> selector) => - selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long)); + selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long)); public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => - selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long)); + selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long)); public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => - selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long)); + selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long)); public IProperty Scalar(Expression>> field, Func, INumberProperty> selector) => - selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long)); + selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long)); public IProperty Scalar(Expression>> field, Func, INumberProperty> selector) => - selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long)); + selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long)); public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => - selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long)); + selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long)); public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => - selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long)); + selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long)); public IProperty Scalar(Expression>> field, Func, INumberProperty> selector) => - selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long)); + selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long)); public IProperty Scalar(Expression>> field, Func, INumberProperty> selector) => - selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long)); + selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long)); public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => - selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double)); + selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double)); public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => - selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double)); + selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double)); public IProperty Scalar(Expression>> field, Func, INumberProperty> selector) => - selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double)); + selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double)); public IProperty Scalar(Expression>> field, Func, INumberProperty> selector) => - selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double)); + selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double)); public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => - selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double)); + selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double)); public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => - selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double)); + selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double)); public IProperty Scalar(Expression>> field, Func, INumberProperty> selector) => - selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double)); + selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double)); public IProperty Scalar(Expression>> field, Func, INumberProperty> selector) => - selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double)); + selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double)); public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => - selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double)); + selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double)); public IProperty Scalar(Expression> field, Func, INumberProperty> selector) => - selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double)); + selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double)); public IProperty Scalar(Expression>> field, Func, INumberProperty> selector) => - selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double)); + selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double)); public IProperty Scalar(Expression>> field, Func, INumberProperty> selector) => - selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double)); + selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double)); public IProperty Scalar(Expression> field, Func, IDateProperty> selector) => - selector?.InvokeOrDefault(new DatePropertyDescriptor().Name(field)); + selector.InvokeOrDefault(new DatePropertyDescriptor().Name(field)); public IProperty Scalar(Expression> field, Func, IDateProperty> selector) => - selector?.InvokeOrDefault(new DatePropertyDescriptor().Name(field)); + selector.InvokeOrDefault(new DatePropertyDescriptor().Name(field)); public IProperty Scalar(Expression>> field, Func, IDateProperty> selector) => - selector?.InvokeOrDefault(new DatePropertyDescriptor().Name(field)); + selector.InvokeOrDefault(new DatePropertyDescriptor().Name(field)); public IProperty Scalar(Expression>> field, Func, IDateProperty> selector) => - selector?.InvokeOrDefault(new DatePropertyDescriptor().Name(field)); + selector.InvokeOrDefault(new DatePropertyDescriptor().Name(field)); public IProperty Scalar(Expression> field, Func, IDateProperty> selector) => - selector?.InvokeOrDefault(new DatePropertyDescriptor().Name(field)); + selector.InvokeOrDefault(new DatePropertyDescriptor().Name(field)); public IProperty Scalar(Expression> field, Func, IDateProperty> selector) => - selector?.InvokeOrDefault(new DatePropertyDescriptor().Name(field)); + selector.InvokeOrDefault(new DatePropertyDescriptor().Name(field)); public IProperty Scalar(Expression>> field, Func, IDateProperty> selector) => - selector?.InvokeOrDefault(new DatePropertyDescriptor().Name(field)); + selector.InvokeOrDefault(new DatePropertyDescriptor().Name(field)); public IProperty Scalar(Expression>> field, Func, IDateProperty> selector) => - selector?.InvokeOrDefault(new DatePropertyDescriptor().Name(field)); + selector.InvokeOrDefault(new DatePropertyDescriptor().Name(field)); public IProperty Scalar(Expression> field, Func, IBooleanProperty> selector) => - selector?.InvokeOrDefault(new BooleanPropertyDescriptor().Name(field)); + selector.InvokeOrDefault(new BooleanPropertyDescriptor().Name(field)); public IProperty Scalar(Expression> field, Func, IBooleanProperty> selector) => - selector?.InvokeOrDefault(new BooleanPropertyDescriptor().Name(field)); + selector.InvokeOrDefault(new BooleanPropertyDescriptor().Name(field)); public IProperty Scalar(Expression>> field, Func, IBooleanProperty> selector) => - selector?.InvokeOrDefault(new BooleanPropertyDescriptor().Name(field)); + selector.InvokeOrDefault(new BooleanPropertyDescriptor().Name(field)); public IProperty Scalar(Expression>> field, Func, IBooleanProperty> selector) => - selector?.InvokeOrDefault(new BooleanPropertyDescriptor().Name(field)); + selector.InvokeOrDefault(new BooleanPropertyDescriptor().Name(field)); public IProperty Scalar(Expression> field, Func, IKeywordProperty> selector) => - selector?.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field)); + selector.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field)); public IProperty Scalar(Expression> field, Func, IKeywordProperty> selector) => - selector?.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field)); + selector.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field)); public IProperty Scalar(Expression>> field, Func, IKeywordProperty> selector) => - selector?.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field)); + selector.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field)); public IProperty Scalar(Expression>> field, Func, IKeywordProperty> selector) => - selector?.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field)); + selector.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field)); public IProperty Scalar(Expression> field, Func, IKeywordProperty> selector) => - selector?.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field)); + selector.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field)); public IProperty Scalar(Expression> field, Func, IKeywordProperty> selector) => - selector?.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field)); + selector.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field)); public IProperty Scalar(Expression>> field, Func, IKeywordProperty> selector) => - selector?.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field)); + selector.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field)); public IProperty Scalar(Expression>> field, Func, IKeywordProperty> selector) => - selector?.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field)); + selector.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field)); public IProperty Scalar(Expression> field, Func, ITextProperty> selector) => - selector?.InvokeOrDefault(new TextPropertyDescriptor().Name(field)); + selector.InvokeOrDefault(new TextPropertyDescriptor().Name(field)); public IProperty Scalar(Expression>> field, Func, ITextProperty> selector) => - selector?.InvokeOrDefault(new TextPropertyDescriptor().Name(field)); + selector.InvokeOrDefault(new TextPropertyDescriptor().Name(field)); #pragma warning restore CS3001 // Argument type is not CLS-compliant } } diff --git a/src/Nest/Mapping/Types/Properties-Scalar.cs b/src/Nest/Mapping/Types/Properties-Scalar.cs index 56de3f2dd4c..1c65c4c36ac 100644 --- a/src/Nest/Mapping/Types/Properties-Scalar.cs +++ b/src/Nest/Mapping/Types/Properties-Scalar.cs @@ -101,154 +101,154 @@ public partial class PropertiesDescriptor : IsADictionaryDescriptorBase Scalar(Expression> field, Func, INumberProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Integer))); + SetProperty(selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Integer))); public PropertiesDescriptor Scalar(Expression>> field, Func, INumberProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Integer))); + SetProperty(selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Integer))); public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Integer))); + SetProperty(selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Integer))); public PropertiesDescriptor Scalar(Expression>> field, Func, INumberProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Integer))); + SetProperty(selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Integer))); public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Float))); + SetProperty(selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Float))); public PropertiesDescriptor Scalar(Expression>> field, Func, INumberProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Float))); + SetProperty(selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Float))); public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Float))); + SetProperty(selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Float))); public PropertiesDescriptor Scalar(Expression>> field, Func, INumberProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Float))); + SetProperty(selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Float))); public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Byte))); + SetProperty(selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Byte))); public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Byte))); + SetProperty(selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Byte))); public PropertiesDescriptor Scalar(Expression>> field, Func, INumberProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Byte))); + SetProperty(selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Byte))); public PropertiesDescriptor Scalar(Expression>> field, Func, INumberProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Byte))); + SetProperty(selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Byte))); public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short))); + SetProperty(selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short))); public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short))); + SetProperty(selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short))); public PropertiesDescriptor Scalar(Expression>> field, Func, INumberProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short))); + SetProperty(selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short))); public PropertiesDescriptor Scalar(Expression>> field, Func, INumberProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short))); + SetProperty(selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short))); public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short))); + SetProperty(selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short))); public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short))); + SetProperty(selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short))); public PropertiesDescriptor Scalar(Expression>> field, Func, INumberProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short))); + SetProperty(selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short))); public PropertiesDescriptor Scalar(Expression>> field, Func, INumberProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short))); + SetProperty(selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short))); public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long))); + SetProperty(selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long))); public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long))); + SetProperty(selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long))); public PropertiesDescriptor Scalar(Expression>> field, Func, INumberProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long))); + SetProperty(selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long))); public PropertiesDescriptor Scalar(Expression>> field, Func, INumberProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long))); + SetProperty(selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long))); public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long))); + SetProperty(selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long))); public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long))); + SetProperty(selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long))); public PropertiesDescriptor Scalar(Expression>> field, Func, INumberProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long))); + SetProperty(selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long))); public PropertiesDescriptor Scalar(Expression>> field, Func, INumberProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long))); + SetProperty(selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long))); public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long))); + SetProperty(selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long))); public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long))); + SetProperty(selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long))); public PropertiesDescriptor Scalar(Expression>> field, Func, INumberProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long))); + SetProperty(selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long))); public PropertiesDescriptor Scalar(Expression>> field, Func, INumberProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long))); + SetProperty(selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long))); public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double))); + SetProperty(selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double))); public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double))); + SetProperty(selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double))); public PropertiesDescriptor Scalar(Expression>> field, Func, INumberProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double))); + SetProperty(selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double))); public PropertiesDescriptor Scalar(Expression>> field, Func, INumberProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double))); + SetProperty(selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double))); public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double))); + SetProperty(selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double))); public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double))); + SetProperty(selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double))); public PropertiesDescriptor Scalar(Expression>> field, Func, INumberProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double))); + SetProperty(selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double))); public PropertiesDescriptor Scalar(Expression>> field, Func, INumberProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double))); + SetProperty(selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double))); public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double))); + SetProperty(selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double))); public PropertiesDescriptor Scalar(Expression> field, Func, INumberProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double))); + SetProperty(selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double))); public PropertiesDescriptor Scalar(Expression>> field, Func, INumberProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double))); + SetProperty(selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double))); public PropertiesDescriptor Scalar(Expression>> field, Func, INumberProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double))); + SetProperty(selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double))); public PropertiesDescriptor Scalar(Expression> field, Func, IDateProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new DatePropertyDescriptor().Name(field))); + SetProperty(selector.InvokeOrDefault(new DatePropertyDescriptor().Name(field))); public PropertiesDescriptor Scalar(Expression> field, Func, IDateProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new DatePropertyDescriptor().Name(field))); + SetProperty(selector.InvokeOrDefault(new DatePropertyDescriptor().Name(field))); public PropertiesDescriptor Scalar(Expression>> field, Func, IDateProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new DatePropertyDescriptor().Name(field))); + SetProperty(selector.InvokeOrDefault(new DatePropertyDescriptor().Name(field))); public PropertiesDescriptor Scalar(Expression>> field, Func, IDateProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new DatePropertyDescriptor().Name(field))); + SetProperty(selector.InvokeOrDefault(new DatePropertyDescriptor().Name(field))); public PropertiesDescriptor Scalar(Expression> field, Func, IDateProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new DatePropertyDescriptor().Name(field))); + SetProperty(selector.InvokeOrDefault(new DatePropertyDescriptor().Name(field))); public PropertiesDescriptor Scalar(Expression> field, Func, IDateProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new DatePropertyDescriptor().Name(field))); + SetProperty(selector.InvokeOrDefault(new DatePropertyDescriptor().Name(field))); public PropertiesDescriptor Scalar(Expression>> field, Func, IDateProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new DatePropertyDescriptor().Name(field))); + SetProperty(selector.InvokeOrDefault(new DatePropertyDescriptor().Name(field))); public PropertiesDescriptor Scalar(Expression>> field, Func, IDateProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new DatePropertyDescriptor().Name(field))); + SetProperty(selector.InvokeOrDefault(new DatePropertyDescriptor().Name(field))); public PropertiesDescriptor Scalar(Expression> field, Func, IBooleanProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new BooleanPropertyDescriptor().Name(field))); + SetProperty(selector.InvokeOrDefault(new BooleanPropertyDescriptor().Name(field))); public PropertiesDescriptor Scalar(Expression> field, Func, IBooleanProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new BooleanPropertyDescriptor().Name(field))); + SetProperty(selector.InvokeOrDefault(new BooleanPropertyDescriptor().Name(field))); public PropertiesDescriptor Scalar(Expression>> field, Func, IBooleanProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new BooleanPropertyDescriptor().Name(field))); + SetProperty(selector.InvokeOrDefault(new BooleanPropertyDescriptor().Name(field))); public PropertiesDescriptor Scalar(Expression>> field, Func, IBooleanProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new BooleanPropertyDescriptor().Name(field))); + SetProperty(selector.InvokeOrDefault(new BooleanPropertyDescriptor().Name(field))); public PropertiesDescriptor Scalar(Expression> field, Func, IKeywordProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field))); + SetProperty(selector.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field))); public PropertiesDescriptor Scalar(Expression> field, Func, IKeywordProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field))); + SetProperty(selector.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field))); public PropertiesDescriptor Scalar(Expression>> field, Func, IKeywordProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field))); + SetProperty(selector.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field))); public PropertiesDescriptor Scalar(Expression>> field, Func, IKeywordProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field))); + SetProperty(selector.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field))); public PropertiesDescriptor Scalar(Expression> field, Func, IKeywordProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field))); + SetProperty(selector.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field))); public PropertiesDescriptor Scalar(Expression> field, Func, IKeywordProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field))); + SetProperty(selector.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field))); public PropertiesDescriptor Scalar(Expression>> field, Func, IKeywordProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field))); + SetProperty(selector.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field))); public PropertiesDescriptor Scalar(Expression>> field, Func, IKeywordProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field))); + SetProperty(selector.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field))); public PropertiesDescriptor Scalar(Expression> field, Func, ITextProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new TextPropertyDescriptor().Name(field))); + SetProperty(selector.InvokeOrDefault(new TextPropertyDescriptor().Name(field))); public PropertiesDescriptor Scalar(Expression>> field, Func, ITextProperty> selector) => - SetProperty(selector?.InvokeOrDefault(new TextPropertyDescriptor().Name(field))); + SetProperty(selector.InvokeOrDefault(new TextPropertyDescriptor().Name(field))); #pragma warning restore CS3001 // Argument type is not CLS-compliant } }