Click here to Skip to main content
15,886,110 members
Articles / Web Development / ASP.NET

Filtering LINQ Queries Using Business Rules Engine

19 Nov 2012CPOL7 min read 35.4K   779   22  
This article discusses the use of one such new feature, namely, rule-based filtering of LINQ queries using Web Rule, the XML-based super-fast rules engine, implementable as an ASP.NET or MVC component.

This article is in the Product Showcase section for our sponsors at CodeProject. These articles are intended to provide you with information on products and services that we consider useful and of value to developers.

using CodeEffects.Rule.Attributes;
using CodeEffects.Rule.Common;

namespace CodeEffects.Rule.Demo.Filter.Asp.Common.Entities
{
	// See the following article for details on this interface and why do we need to declare it:
	// http://rule.codeeffects.com/Doc/Preserving-Attributes-In-Auto-Generated-Classes

	public interface ICustomer
	{
		[ExcludeFromEvaluation]
		int CustomerID { get; set; }

		[Field(DisplayName = "Cell Phone", ValueInputType = ValueInputType.User)]
		string CellPhone { get; set; }

		[Field(DisplayName = "Company Name", ValueInputType = ValueInputType.User)]
		string CompanyName { get; set; }

		[Field(DisplayName = "First Name", ValueInputType = ValueInputType.User)]
		string FirstName { get; set; }

		[Field(DisplayName = "Last Name", ValueInputType = ValueInputType.User)]
		string LastName { get; set; }

		[ExcludeFromEvaluation]
		int BillingAddressID { get; set; }

		[Field(DisplayName = "Billing City")]
		string BillingCity { get; set; }

		[Field(DataSourceName = "Countries", DisplayName = "Billing Country")]
		int BillingCountryID { get; set; }

		[Field(DisplayName = "Billing Phone")]
		string BillingPhone { get; set; }

		[Field(DisplayName = "Billing Zip")]
		string BillingPostal { get; set; }

		[Field(DisplayName = "Billing State")]
		string BillingState { get; set; }

		[Field(DisplayName = "Billing Street")]
		string BillingStreet { get; set; }

		[Field(DisplayName = "Billing Apt/Suite")]
		string BillingStreet2 { get; set; }

		[ExcludeFromEvaluation]
		int ShippingAddressID { get; set; }

		[Field(DisplayName = "Shipping City")]
		string ShippingCity { get; set; }

		[Field(DataSourceName = "Countries", DisplayName = "Shipping Country")]
		int ShippingCountryID { get; set; }

		[Field(DisplayName = "Shipping Zip")]
		string ShippingPostal { get; set; }

		[Field(DisplayName = "Shipping State")]
		string ShippingState { get; set; }

		[Field(DisplayName = "Shipping Phone")]
		string ShippingPhone { get; set; }

		[Field(DisplayName = "Shipping Street")]
		string ShippingStreet { get; set; }

		[Field(DisplayName = "Shipping Apt/Suite")]
		string ShippingStreet2 { get; set; }
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions