public ProductsCollection Products_LoadWithExtraColumn()
        {
            ProductsQuery p = new ProductsQuery("p");
            SuppliersQuery s = new SuppliersQuery("s");

            // Bring back the suppliers name for the Product from the Supplier table
            p.Select(p, s.CompanyName.As("SupplierName"));
            p.InnerJoin(s).On(p.SupplierID == s.SupplierID);

            ProductsCollection coll = new ProductsCollection();
            coll.Load(p);

            return coll;
        }
        private void buttonQuery_Click(object sender, EventArgs e)
        {
            // ListBox
            ProductsCollection prdColl = new ProductsCollection();
            prdColl.Query.Select(prdColl.Query.ProductID, prdColl.Query.ProductName);
            prdColl.Query.Load();

            listBox1.DisplayMember = ProductsMetadata.PropertyNames.ProductName;
            listBox1.ValueMember = ProductsMetadata.PropertyNames.ProductID;
            listBox1.DataSource = prdColl;

            // DataGridView

            // The main query

            coll = new ProductsCollection();
            coll.Query.Where(coll.Query.Discontinued == false);
            coll.Query.Load();

            bindingSource1.DataSource = coll;
            dataGridView1.DataSource = bindingSource1;
        }
		public ProductsCollectionProxyStub Products_QueryForCollection(string serializedQuery)
		{
			ProductsQuery query = ProductsQuery.SerializeHelper.FromXml(
				serializedQuery, typeof(ProductsQuery), AllKnownTypes) as ProductsQuery;

			ProductsCollection coll = new ProductsCollection();
			if (coll.Load(query))
			{
				return coll;
			}

			return null;
		}
		public ProductsCollectionProxyStub Products_LoadAll()
		{
			ProductsCollection coll = new ProductsCollection();
			if (coll.LoadAll())
			{
				return coll;
			}

			return null;
		}		
		public ProductsCollection Products_LoadByDynamic(string serializedQuery)
		{
			ProductsQuery query = ProductsQuery.SerializeHelper.FromXml(
				serializedQuery, typeof(ProductsQuery), AllKnownTypes) as ProductsQuery;

			ProductsCollection coll = new ProductsCollection();
			coll.es.IsLazyLoadDisabled = true;
			coll.Load(query);
			return coll;
		}
		public ProductsCollection Products_LoadAll()
		{
			ProductsCollection coll = new ProductsCollection();
			coll.es.IsLazyLoadDisabled = true;
			coll.LoadAll();
			return coll;
		}
		public jsResponse<ProductsCollection, Products> ProductsCollection_Save(ProductsCollection collection)
		{
			jsResponse<ProductsCollection, Products> response = new jsResponse<ProductsCollection, Products>();

			try
			{
				collection.Save();
				response.collection = collection;
			}
			catch (Exception ex)
			{
				response.exception = ex.Message;
			}

			return response;
		}
		public jsResponse<ProductsCollection, Products> ProductsCollection_LoadAll()
		{
			jsResponse<ProductsCollection, Products> response = new jsResponse<ProductsCollection, Products>();

			try
			{
				ProductsCollection collection = new ProductsCollection();
				collection.LoadAll();
				response.collection = collection;
			}
			catch (Exception ex)
			{
				response.exception = ex.Message;
			}

			return response;
		}