// If your activity returns a value, derive from CodeActivity<TResult>
        // and return the value from the Execute method.
        protected override void Execute(CodeActivityContext context)
        {
            SalesOrderDetail salesDetail = SalesDetail.Get(context);
            using (AdventureWorksDataContext dc = new AdventureWorksDataContext())
            {
                var historyRow = new TransactionHistory();
                historyRow.ProductID = salesDetail.ProductID;
                historyRow.ModifiedDate = DateTime.Now;
                historyRow.Quantity = salesDetail.OrderQty;
                historyRow.TransactionDate = salesDetail.ModifiedDate;
                historyRow.TransactionType = 'S';
                historyRow.ReferenceOrderID = salesDetail.SalesOrderID;
                historyRow.ReferenceOrderLineID = salesDetail.SalesOrderDetailID;
                dc.TransactionHistories.InsertOnSubmit(historyRow);
                dc.SubmitChanges();
                Console.WriteLine("Product {0}: Added history for Qty of {1} ",salesDetail.ProductID, salesDetail.OrderQty);
            }

        }
 partial void DeleteTransactionHistory(TransactionHistory instance);
 partial void UpdateTransactionHistory(TransactionHistory instance);
 partial void InsertTransactionHistory(TransactionHistory instance);
		private void detach_TransactionHistories(TransactionHistory entity)
		{
			this.SendPropertyChanging();
			entity.Product = null;
		}