예제 #1
0
        static void Main(string[] args)
        {
            #region ADO .NET

            //string connectionString = @"Data Source=.\SQLEXPRESS;Initial Catalog=kaspilab;Integrated Security=True";

            //string queryString =
            //    "SElECT TypeProductId, CreateDate, ExpireDate, IBAN, ClientId, CurrentBalance, Number FROM Agreement as a " +
            //    "INNER JOIN AccountIBAN as iban on a.IBANId = iban.id AND " +
            //    "a.ClientId in (SELECT cd.ClientId FROM ClientDocument as cd WHERE cd.Number = '395028320615')";

            //using (SqlConnection connection = new SqlConnection(connectionString))
            //{

            //    SqlCommand command = new SqlCommand(queryString, connection);

            //    try
            //    {
            //        connection.Open();
            //        SqlDataReader reader = command.ExecuteReader();

            //        Console.WriteLine("TypeProductId, CreateDate, ExpireDate, IBAN, ClientId, CurrentBalance, Number");

            //        while (reader.Read())
            //        {
            //            Console.WriteLine($"{reader[0]}, {reader[1]}, {reader[2]}, {reader[3]}, {reader[4]}, {reader[5]}, {reader[6]}");
            //        }
            //    }
            //    catch (Exception ex)
            //    {
            //        Console.WriteLine(ex.Message);
            //    }
            //}

            #endregion


            #region Entity Framework

            AddressRepository addressRep = new AddressRepository();

            foreach (var item in addressRep.GetList(i => i.City.StartsWith("A")))
            {
                Console.WriteLine(item.City);
            }

            addressRep.Dispose();

            #endregion

            Console.ReadKey();
        }
예제 #2
0
 /// <summary>
 /// Disposes all external resources.
 /// </summary>
 /// <param name="disposing">The dispose indicator.</param>
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (_databaseContext != null)
         {
             _databaseContext.Dispose();
         }
         if (_objRepo != null)
         {
             _objRepo.Dispose();
         }
     }
 }
예제 #3
0
        private void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (_repositoryStore != null)
                {
                    _repositoryStore.Dispose();
                }

                if (_repositoryAddress != null)
                {
                    _repositoryAddress.Dispose();
                }
            }
        }