public void Update()
        {
            OrmEngine.Instance().InitializeDatabase();
            AutoContext db = new AutoContext();
            DAIList<Category> categories = db.Category.ToList();
            Category category = categories[0];
            category.CategoryName = "pc3";

            db.Category.Update(category);
            //provider.Update(new Product() { Id = 2, ProductCode = "Ali", ProductName= "Kaya" });
            db.SaveChanges();
        }
 public void ContextExtensionTest()
 {
     ConfigurationManager.ConnectionStrings["DEFAULT"].ToString();
     AutoContext db = new AutoContext();
     DAIList<Category> cats = db.Category.Where(i=> i.Id == 8).ToList();
     DbContext a = new DbContext();
     a.Adi = "dai";
     a.TransformText();
 }
 public void WhereClause()
 {
     AutoContext db = new AutoContext();
     DAIList<Product> products = new DAIList<Product>();
     products = db.Product.Where(i => i.Id == 1 && i.ProductName == "Mac" || i.CategoryId != 3).ToList();
 }
 public void RelationMap()
 {
     AutoContext db = new AutoContext();
     DAIList<Product> products = db.Product.ToList();
     DAIList<Category> cat = products[0].Categories;
 }
 public void SkipTake()
 {
     DAIList<Category> cats = new AutoContext().Category.ToList().Skip(1).Take(2);
 }
        public void Skip()
        {
            DAIList<Product> product = new AutoContext().Product.ToList().Skip(1);

        }
 public void Take()
 {
     DAIList<Product> product = new AutoContext().Product.Take(1);
 }
        public void First()
        {
            AutoContext db = new AutoContext();

            Category dai = db.Category.First();
        }
 public void Last()
 {
     AutoContext db = new AutoContext();
     //Product p = db.Product.Last();
 }
 public void Sum()
 {
     AutoContext db = new AutoContext();
     decimal sumID = db.Product.Sum(c => c.Id);
 }
 public void GroupBy()
 {
     AutoContext db = new AutoContext();
     DAIList<Category> cats = db.Category.GroupBy(i => i.CategoryName);
 }
 public void Avg()
 {
     AutoContext db = new AutoContext();
     decimal avg = db.Product.Avg(i => i.Id);
 }
 public void OrderByDesc()
 {
     AutoContext db = new AutoContext();
     DAIList<Product> prs = db.Product.OrderByDescending(i => i.ProductName);
 }
 public void Min()
 {
     AutoContext db = new AutoContext();
     decimal minId = db.Product.Min(p => p.Id);
 }
 public void Max()
 {
     AutoContext db = new AutoContext();
     decimal maxId = db.Category.Max(p => p.Id);
 }
 public void LastFieldValue()
 {
     AutoContext db = new AutoContext();
     //string lastCatName = db.Category.LastFieldValue("CategoryName").ToString();
 }
        public void CodeGeneration()
        {
            List<Category> dai = new List<Category>();
            //Category a = new Category();
            //a.CategoryCode = "dai";
            //DbContext context = new DbContext();

            //OrmEngine.Instance().InitializeDatabase();
            //Product b = new Product();
            //b.ProductCode = "a";
            //context.Product.Add(b);
            //DAIList<Product> cat = context.Product.Where(p => p.ProductCode == "a");

            AutoContext db = new AutoContext();
            DAIList<Category> cat = db.Category.Where(p => p.CategoryName == "mac");

            DAIList<Product> Products = db.Product.ToList().OrderByDescending(p => p.Id);
            Product a = Products[0];
            var b = a.Categories;

        }
 public void SaveChanges()
 {
     AutoContext db = new AutoContext();
     db.Category.AddItem(new Category() { CategoryCode = "cd", CategoryName = "dvd" });
     db.SaveChanges();
 }