Bodoconsult.Core.ExpressionBuilder 1.0.2

dotnet add package Bodoconsult.Core.ExpressionBuilder --version 1.0.2                
NuGet\Install-Package Bodoconsult.Core.ExpressionBuilder -Version 1.0.2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Bodoconsult.Core.ExpressionBuilder" Version="1.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Bodoconsult.Core.ExpressionBuilder --version 1.0.2                
#r "nuget: Bodoconsult.Core.ExpressionBuilder, 1.0.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Bodoconsult.Core.ExpressionBuilder as a Cake Addin
#addin nuget:?package=Bodoconsult.Core.ExpressionBuilder&version=1.0.2

// Install Bodoconsult.Core.ExpressionBuilder as a Cake Tool
#tool nuget:?package=Bodoconsult.Core.ExpressionBuilder&version=1.0.2                

What does the library

Bodoconsult.Core.ExpressionBuilder is intended to provide enhanced search features on entitiy classes for user interfaces like WinForms, WPF or Xamarin Forms.

Bodoconsult.Core.ExpressionBuilder is based on the work of David Belmont. See licence file and https://github.com/dbelmont/ExpressionBuilder/tree/master/ExpressionBuilder. We did some changes for better fit to our projects.

How to use the library

The source code contains a NUnit test class, the following source code is extracted from. It sample shows the most helpful use cases for the library.

Getting object properties fur building expressions in UI

Not localized properties

This example shows how to get the queryable properties of a class Person. It provides the properties in a non-localized fashion, means the original property names are used.


            var result = ExpressionPropertiesHelper.LoadPropertyCollection<Person>();
            result.LoadProperties(null);

            var properties = result.ToList();
			

Localized properties

The next example shows to to use localized properties. Bodoconsult.Core.ExpressionBuilder uses C# builtin localization features based on ResourceManager.

Create a resx file for the class like with normal builtin C# localization. Here the folder structure for a class Person:

	Resources
		Person.resx
		Person.pt.resx
		Person.de.resx

Then call LoadProperties with adequate ResourceManager:


            var result = ExpressionPropertiesHelper.LoadPropertyCollection<Person>();
            result.LoadProperties(Resources.Person.ResourceManager);

            var properties = result.ToList();

Building and using an expression

The following example shows how to use


        [TestCase(TestName="Build expression from a filter with property chain filter statements")]
        public void BuilderWithPropertyChainFilterStatements()
        {
            var filter = new Filter<Person>();
            filter.By("Birth.Country", Operation.EqualTo, "usa", value2: default, FilterStatementConnector.Or);
            filter.By("Birth.Date", Operation.LessThanOrEqualTo, new DateTime(1980, 1, 1), connector: FilterStatementConnector.Or);
            filter.By("Name", Operation.Contains, "Doe");
            
            var people = People.Where(filter);
            
            var solution = People.Where(p => (p.Birth != null && p.Birth.Country != null && p.Birth.Country.Trim().ToLower().Equals("usa")) ||
                                             (p.Birth != null && p.Birth.Date <= new DateTime(1980, 1, 1)) ||
                                             p.Name.Trim().ToLower().Contains("doe"));
            
            Assert.That(people, Is.EquivalentTo(solution));
        }

User interface integration

The example before shows how to build expressions and use it generally. In practise the expression should be built up from user input from user interface.

For an example please see the included project Bodoconsult.Core.ExpressionBuilder.WinForms for fully fucntional example how to use Bodoconsult.Core.ExpressionBuilder.

About us

Bodoconsult (http://www.bodoconsult.de) is a Munich based software development company.

Robert Leisner is senior software developer at Bodoconsult. See his profile on http://www.bodoconsult.de/Curriculum_vitae_Robert_Leisner.pdf.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.2 320 12/20/2022
1.0.1 463 12/11/2020
1.0.0 373 12/9/2020

Updates dependencies and added README.md