static void Main(string[] args) { WriteLine("Hello World!"); // Install-Package Microsoft.Extensions.Configuration // Install-Package Microsoft.Extensions.Configuration.FileExtensions // Install-Package Microsoft.Extensions.Configuration.Json var builder = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true); IConfigurationRoot configuration = builder.Build(); WriteLine(configuration.GetConnectionString("ShopConnection")); // Install-Package Microsoft.Extensions.DependencyInjection ServiceCollection services = new ServiceCollection(); services.AddTransient <ICustomersService, DbCustomersService>(); services.AddTransient <IItemsService, DbItemsService>(); // Install-Package Microsoft.EntityFrameworkCore.SqlServer services.AddDbContext <ShopContext>(options => options .UseSqlServer(configuration.GetConnectionString("ShopConnection"))); ServiceProvider serviceProvider = services.BuildServiceProvider(); // ICustomersService customersService = new FakeCustomersService(); ICustomersService customersService = serviceProvider.GetService <ICustomersService>(); var query = customersService.Get(); var items = new FakeItemsService().Get(); IItemsService itemsService = serviceProvider.GetService <IItemsService>(); itemsService.AddRange(items); var customers = customersService.Search(new CustomerSearchCriteria { Country = "Poland" }); var newCustomers = new FakeCustomersService().Get(); foreach (var newCustomer in newCustomers) { customersService.Add(newCustomer); } LinqTest(customersService); // Uwaga: W przypadku float/double mimo dzielenia przez zero nie pojawi się błąd, // lecz przyjmie wartość infinity! double result = 2d / 0; Console.WriteLine(result); // DelegateTest(); // Typ anonimowy // AnonymouseTypeTest(); Customer customer = GetCustomer(); var order = new Order(customer); Item item; do { item = GetItem(); int quantity = GetQuantity(); OrderDetail detail = new OrderDetail(item, quantity); order.AddDetail(detail); } while (item != null); // EnumTest(order); // ExtensionsMethodTest(); GetCustomersTest(); // GetItemsTest(); #region Variable vs Reference Types VariableTest(); StringTest(); ReferenceTest(); #endregion Helper.GreaterThanZero(100); }