コード例 #1
0
 public void DeleteCustomer(Customer customer)
 {
     const string sql = "DELETE FROM Customer WHERE ID = @id";
     new FluentCommand<Customer>(sql)
         .AddGuid("id", customer.ID)
         .AsNonQuery();
 }
コード例 #2
0
        public void AddCustomer(Customer customer)
        {
            customer.ID = Guid.NewGuid();
            const string sql = @"INSERT INTO Customer
            (ID, FirstName, LastName, BirthDay, Height, Weight)
            VALUES (@id,@firstName,@lastName,@birthday,@height,@weight)";

            new FluentCommand<string>(sql)
                .AddGuid("id", customer.ID)
                .AddString("firstName", customer.FirstName)
                .AddString("lastName", customer.LastName)
                .AddDateTime("birthday", customer.Birthday)
                .AddDecimal("height", customer.Height)
                .AddInt("weight", customer.Weight)
                .AsNonQuery();
        }