Ejemplo n.º 1
0
        //private static readonly String sPublishQueuePath = ".\\private$\\BankTransferQueueTransacted";
        //private static void EnsureMessageQueuesExists()
        //{
        //    // Create the transacted MSMQ queue if necessary.
        //    if (!MessageQueue.Exists(sPublishQueuePath))
        //        MessageQueue.Create(sPublishQueuePath, true);
        //}

        private static void CreateDummyEntities()
        {
            using (TransactionScope lScope = new TransactionScope())
            using (BankEntityModelContainer lContainer = new BankEntityModelContainer())
            {
                if (lContainer.Accounts.Count() == 0)
                {
                    Customer lVideoStore = new Customer();
                    Account lVSAccount = new Account() { AccountNumber = 123, Balance = 0 };
                    lVideoStore.Accounts.Add(lVSAccount);

                    Customer lCustomer = new Customer();
                    Account lCustAccount = new Account() { AccountNumber = 456, Balance = 20 };
                    lCustomer.Accounts.Add(lCustAccount);


                    lContainer.Customers.AddObject(lVideoStore);
                    lContainer.Customers.AddObject(lCustomer);


                    lContainer.SaveChanges();
                    lScope.Complete();
                }
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Create a new Account object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="accountNumber">Initial value of the AccountNumber property.</param>
 /// <param name="balance">Initial value of the Balance property.</param>
 public static Account CreateAccount(global::System.Int32 id, global::System.Int32 accountNumber, global::System.Decimal balance)
 {
     Account account = new Account();
     account.Id = id;
     account.AccountNumber = accountNumber;
     account.Balance = balance;
     return account;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Accounts EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToAccounts(Account account)
 {
     base.AddObject("Accounts", account);
 }