C4 wrote:
I look forward to working with LLBLGenPro 2006... Do we have an ETA yet???
Not yet. We hope to have done all necessary features by the end of march.
I have a teaser though:
[Test]
public void EntityViewFilteringTestTypedCollection()
{
using( DataAccessAdapter adapter = new DataAccessAdapter() )
{
EntityCollection<CustomerEntity> customers = new EntityCollection<CustomerEntity>( new CustomerEntityFactory() );
adapter.FetchEntityCollection( customers, null );
EntityView2<CustomerEntity> customersInGermanyView = new EntityView2<CustomerEntity>( customers, (CustomerFields.Country == "Germany"), null );
Assert.AreEqual( 11, customersInGermanyView.Count );
for( int i = 0; i < customersInGermanyView.Count; i++ )
{
Console.WriteLine( "{0}: CustomerID: {1}. CompanyName: {2}",
i, customersInGermanyView[i].CustomerId, customersInGermanyView[i].CompanyName );
}
EntityView2<CustomerEntity> customersWhichAreOwner = new EntityView2<CustomerEntity>( customers, (CustomerFields.ContactTitle == "Owner"), null );
Assert.AreEqual( 16, customersWhichAreOwner.Count );
EntityView2<CustomerEntity> customersInGermanyAndOwnerView = new EntityView2<CustomerEntity>( customers,
new PredicateExpression( CustomerFields.Country == "Germany" ).AddWithAnd( CustomerFields.ContactTitle == "Owner" ), null );
Assert.AreEqual( 1, customersInGermanyAndOwnerView.Count );
ResultsetViewer20 viewer = new ResultsetViewer20();
viewer.BindView( customersInGermanyView );
viewer.ShowDialog( null );
customersInGermanyAndOwnerView[0].ContactTitle = "Changed";
Assert.AreEqual( 0, customersInGermanyAndOwnerView.Count );
}
}
[Test]
public void EntityViewMultiSorting()
{
using( DataAccessAdapter adapter = new DataAccessAdapter() )
{
EntityCollection<CustomerEntity> customers = new EntityCollection<CustomerEntity>( new CustomerEntityFactory() );
adapter.FetchEntityCollection( customers, null );
ISortExpression sorter = new SortExpression( CustomerFields.Country | SortOperator.Ascending );
sorter.Add( CustomerFields.ContactTitle | SortOperator.Descending) ;
sorter.Add( CustomerFields.CustomerId | SortOperator.Ascending );
EntityView2<CustomerEntity> customersSorted = new EntityView2<CustomerEntity>( customers, sorter );
ResultsetViewer20 viewer = new ResultsetViewer20();
viewer.BindView( customersSorted );
viewer.ShowDialog( null );
}
}
very raw tests, just to see if it initially works, but as you can see, normal strong typed filters and sorters are usable for creating a view in-memory on an entity collection .