Documentation of free .NET O/R Mapper - Code Generator Invist

Edit

CompoundFilter

The CompoundFilter represents a list of condition combined with "And" or "OR" in sql for example:

SELECT * FROM Products WHERE  ( (Products.SupplierId = Suppliers.SupplierId) AND (Products.SupplierId = 1) );

.NET Code looks like as follows:

// using Invist.Persistence.Database.Entities
// using Invist.Persistence.Database.Filters

IEntityLoader<Product> loader = new EntityLoader<Product>();

var leftItem = new CompareItem( typeof( Product ), Product.SupplierIDProperty );
var rightItem = new CompareItem( typeof( Supplier ), Supplier.SupplierIDProperty );
var compareFilter = new CompareFilter( leftItem, CompareOperator.Equal, rightItem );

var constantValueFilter = new ConstantValueFilter(
    typeof( Product ),
    Product.SupplierIDProperty,
    CompareOperator.Equal, 1 );

var compoundFilter = new CompoundFilter( CompoundOperator.And );
compoundFilter.AddFilter( compareFilter );
compoundFilter.AddFilter( constantValueFilter );

IEnumerable<Product> list = loader.LoadEntities( filter );

ScrewTurn Wiki version 2.0.35. Some of the icons created by FamFamFam. Invist is powered by Mirko Meier