Exemple #1
0
        private Guid CreateScenario()
        {
            var company = new Company()
            {
                Name = "Company test"
            };
            var address = new Address()
            {
                Name = "Address test"
            };
            var bankAccount = new BankAccount()
            {
                Name = "Bank test"
            };

            company.AddAddress(address);
            company.AddBank(bankAccount);
            using (ISession session = sessions.OpenSession())
            {
                using (ITransaction tx = session.BeginTransaction())
                {
                    session.Persist(company);
                    tx.Commit();
                }
            }
            return(company.Id);
        }
Exemple #2
0
        private async Task <Guid> CreateScenarioAsync(CancellationToken cancellationToken = default(CancellationToken))
        {
            var company = new Company()
            {
                Name = "Company test"
            };
            var address = new Address()
            {
                Name = "Address test"
            };
            var bankAccount = new BankAccount()
            {
                Name = "Bank test"
            };

            company.AddAddress(address);
            company.AddBank(bankAccount);
            using (ISession session = Sfi.OpenSession())
            {
                using (ITransaction tx = session.BeginTransaction())
                {
                    await(session.PersistAsync(company, cancellationToken));
                    await(tx.CommitAsync(cancellationToken));
                }
            }
            return(company.Id);
        }
Exemple #3
0
		private Guid CreateScenario()
		{
			var company = new Company() {Name = "Company test"};
			var address = new Address() {Name = "Address test"};
			var bankAccount = new BankAccount() {Name = "Bank test"};
			company.AddAddress(address);
			company.AddBank(bankAccount);
			using (ISession session = sessions.OpenSession())
			{
				using (ITransaction tx = session.BeginTransaction())
				{
					session.Persist(company);
					tx.Commit();
				}
			}
			return company.Id;
		}