Hello.
Thank you for you reply, Didie.
I can build such a LINQ query appending OrderBy clause.
I've prepared simple solution to show, what I mean, but I cannot attach it there...
Any way, I did screenshots, it's in attachment, and I'll try to posts all the code right here...
public
partial
class
MainWindow : Window
{
private
TestEntities testEntities;
public
MainWindow()
{
this
.InitializeComponent();
// EmployeeService.Install();
this
.testEntities =
new
TestEntities(EmployeeService.ConnectionString);
this
.RadGridView.ItemsSource =
new
QueryableCollectionView(
this
.testEntities.Set<Employee>());
}
}
public
class
TestEntities : DbContext
{
public
TestEntities(
string
connectionString)
:
base
(connectionString)
{
}
protected
override
void
OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Entity<Employee>().ToTable(
"Employee"
);
}
}
public
class
EmployeeService
{
public
const
string
ConnectionString =
"Test1"
;
public
static
void
Install()
{
var employees = GetEmployees();
using
(var testEntities =
new
TestEntities(ConnectionString))
{
var
set
= testEntities.Set<Employee>();
foreach
(var employee
in
employees)
{
set
.Add(employee);
}
testEntities.SaveChanges();
}
}
private
static
IEnumerable<Employee> GetEmployees()
{
var employees =
new
List<Employee>();
var employee =
new
Employee { FirstName =
"Maria"
, LastName =
"Anders"
, IsMarried =
true
, Age = 24 };
employees.Add(employee);
employee =
new
Employee { FirstName =
"Ana"
, LastName =
"Trujillo"
, IsMarried =
true
, Age = 44 };
employees.Add(employee);
........
return
employees;
}
}