sorry for the inconvenience as caused.
here is my code:
using System;
using System.IO;
using System.Data;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Northwind.Tutorial.DatabaseSpecific;
using Northwind.Tutorial.EntityClasses;
using Northwind.Tutorial.FactoryClasses;
using Northwind.Tutorial.HelperClasses;
using Northwind.Tutorial.RelationClasses;
using Northwind.Tutorial.TypedViewClasses;
using Northwind.Tutorial;
using DevExpress.XtraGrid.Views.Card;
using DevExpress.XtraEditors.Repository;
using SD.LLBLGen.Pro.ORMSupportClasses;
namespace NorthwindConsole
{
public partial class SecondViewer : Form
{
private DataAccessAdapter DAA;
public SecondViewer()
{
InitializeComponent();
DataLoad();
}
private void DataLoad()
{
DAA = new DataAccessAdapter();
PatientEntity patient = new PatientEntity();
BookingEntity booking = new BookingEntity();
DAA.FetchEntity(booking);
}
private void button1_Click(object sender, EventArgs e)
{
IPrefetchPath2 path= new PrefetchPath2((int)EntityType.PatientEntity);
path.Add(PatientEntity.PrefetchPathBookings);
EntityCollection<PatientEntity> patients = new EntityCollection<PatientEntity>();
IRelationPredicateBucket bucket = new RelationPredicateBucket();
bucket.Relations.Add(PatientEntity.Relations.BookingEntityUsingPatient_ID);
bucket.PredicateExpression.Add(PatientFields.Surname == "Andersen");
bucket.PredicateExpression.Add(BookingFields.Duration > 15);
SortExpression sorter = new SortExpression();
sorter.Add(PatientFields.FirstName | SortOperator.Ascending);
DAA.FetchEntityCollection(patients, bucket, 0, sorter, path); // syntax - DAA.FetchEntityCollection(ec,rpb,0,prefetchpath)
}
private void SecondViewer_FormClosing(object sender, FormClosingEventArgs e)
{
try
{
DAA.CloseConnection();
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}
private void button2_Click(object sender, EventArgs e)
{
this.Close();
}
private void button3_Click(object sender, EventArgs e)
{
this.Hide();
Viewer v = new Viewer();
v.Show();
}
private void SecondViewer_Load(object sender, EventArgs e)
{
var entity = new BookingEntity();
DAA.FetchEntity(entity);
bookingEntityBindingSource.DataSource = entity;
//gridControl2.DataSource = bookingEntityBindingSource;
}
}
}