private bool LoadByPrimaryKeyDynamic(System.Int32 categoryID) { CategoriesQuery query = new CategoriesQuery(); query.Where(query.CategoryID == categoryID); return(this.Load(query)); }
protected void EsDataSource1_esCreateEntity(object sender, EntitySpaces.Web.esDataSourceCreateEntityEventArgs e) { ProductsQuery p = new ProductsQuery("p"); CategoriesQuery c = new CategoriesQuery("c"); p.Select(p, c.CategoryName); p.InnerJoin(c).On(p.CategoryID == c.CategoryID); if (e.PrimaryKeys != null) { p.Where(p.ProductID == (int)e.PrimaryKeys[0]); } else { // They want to add a new one, lets do a select that brings back // no records so that our CategoryName column (virutal) will be // present in the underlying record format p.Where(1 == 0); } Products prd = new Products(); prd.Load(p); // load the data (if any) // Assign the Entity e.Entity = prd; }
protected void InitQuery(CategoriesQuery query) { query.OnLoadDelegate = this.OnQueryLoaded; if (!query.es2.HasConnection) { query.es2.Connection = ((IEntityCollection)this).Connection; } }
protected void EsDataSource1_esSelect(object sender, EntitySpaces.Web.esDataSourceSelectEventArgs e) { ProductsQuery p = new ProductsQuery("P"); CategoriesQuery c = new CategoriesQuery("c"); // All columns from our products table and the CategoryName from the Category table, we really do not // display all of the product fields so I could have selected individual fields out of the products // table p.Select(p, c.CategoryName); p.InnerJoin(c).On(p.CategoryID == c.CategoryID); // We supply the Collection and the Query, because we're letting the grid to auto paging and // auto sorting. Otherwise, we could just load the collection ourselves and only supply the // collection e.Collection = new ProductsCollection(); e.Query = p; }
public bool Load(CategoriesQuery query) { this.query = query; InitQuery(this.query); return(Query.Load()); }
public CategoriesQuery(string joinAlias, out CategoriesQuery query) { query = this; this.es.JoinAlias = joinAlias; }