Ejemplo n.º 1
0
        public void ConnectionScope()
        {
            DagentDatabase db = new DagentDatabase("connectionStringName");

            using (IConnectionScope scope = db.ConnectionScope())
            {
                List <Customer> customers = db.Query <Customer>("Customers").List();

                List <CustomerCategory> customerCategories =
                    db.Query <CustomerCategory>("CustomerCategory").List();
            }
        }
Ejemplo n.º 2
0
        public void DagentTestForIterator()
        {
            IDagentDatabase database = new DagentDatabase("SQLite");

            var customers = database.Query <Customer>("select * from customers").EnumerateList();

            using (var scope = database.ConnectionScope())
            {
                foreach (var customer in customers)
                {
                    customer.CustomerPurchases = database.Query <CustomerPurchase>("select * from customerPurchases where customerId = @customerId", new { customerId = customer.customerId }).List();
                }
            }

            ValidList(customers);
        }