------------- code behind
protected void Page_Init(object sender, EventArgs e)
{
XpoDataSource1.Session = XpoHelper.GetNewSession();
}
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
XpoDataSource1.Criteria = "[TakvimID] <0";
}
}
private void BindGrid()
{
//XpoDataSource1.Criteria = "[MuayeneKayitID] >=3 and [MuayeneKayitID] <=350";
XpoDataSource1.Criteria = null;
this.ASPxGridView1.DataBind();
}
protected void ASPxButton1_Click(object sender, EventArgs e)
{
BindGrid();
}
------------ xpo helper class
using System;
using DevExpress.Xpo;
using DevExpress.Xpo.DB;
using DevExpress.Xpo.Metadata;
using testxpo.dbEkoGorevler;
/// <summary>
/// Summary description for XpoHelper
/// </summary>
public static class XpoHelper
{
 public static Session GetNewSession()
 {
  return new Session(DataLayer);
 }
 public static UnitOfWork GetNewUnitOfWork()
 {
  return new UnitOfWork(DataLayer);
 }
 private readonly static object lockObject = new object();
 static volatile IDataLayer fDataLayer;
 static IDataLayer DataLayer
 {
  get
  {
   if (fDataLayer == null)
   {
    lock (lockObject)
    {
     if (fDataLayer == null)
     {
      fDataLayer = GetDataLayer();
     }
    }
   }
   return fDataLayer;
  }
 }
 private static IDataLayer GetDataLayer()
 {
   XpoDefault.Session = null;
  string conn = @"XpoProvider=MSSqlServer;data source=.;integrated security=SSPI;initial catalog=dbEkoGorevler";
  XPDictionary dict = new ReflectionDictionary();
  IDataStore store = XpoDefault.GetConnectionProvider(conn, AutoCreateOption.SchemaAlreadyExists);
   dict.GetDataStoreSchema(typeof(tbGorevTakvimi).Assembly);
   IDataLayer dl = new ThreadSafeDataLayer(dict, store);
  return dl;
 }
}
Yorumlar
Yorum Gönder