コード例 #1
0
        private static void Main(string[] args)
        {
            IDbProvider provider = new SqlDataProvider();

            provider.ConnectionString = $@"Integrated Security=SSPI;Persist Security Info=False;Initial Catalog={Settings.Instance.Database};Data Source={Settings.Instance.ServerName}";

            var context = new OrmContext(provider);

            Repository <Customer> customers = context.GetRepository <Customer>();
            Repository <PartDto>  parts     = context.GetRepository <PartDto>();

            var customer = new Customer(7, "Laura", "Branigan", 20);

            customers.RowAdded += customers_RowAdded;
            //customers.Insert(customer);
            customers.Delete(customer);
            var property = new DataProperty
            {
                Name  = "FirstName",
                Value = "Michael"
            };

            DataProperty[] properties = { property };
            //customers.Update(properties, "123");
            //parts.Delete("112");

            context.SaveChanges();
        }
コード例 #2
0
 public override void Commit(bool newImplicitTransaction = false)
 {
     if (this.transaction == null)
     {
         OrmContext.SaveChanges();
     }
     else
     {
         OrmContext.SaveChanges();
         transaction.Commit();
         if (newImplicitTransaction)
         {
             transaction.Dispose();
             transaction = BeginTransaction();
         }
     }
 }
コード例 #3
0
 public override void Flush()
 {
     OrmContext.SaveChanges();
 }