Esempio n. 1
0
        static void Main(string[] args)
        {
            var builder = new ConfigurationBuilder();

            builder.SetBasePath(Directory.GetCurrentDirectory());
            builder.AddJsonFile("appsettings.json");
            var config = builder.Build();

            using (var unitOfWork = new UnitOfWork(config.GetConnectionString("DefaultConnection")))
            {
                InitDBIfEmpty(unitOfWork);

                User user = UserFaker.CreateUser();
                user = unitOfWork.UserRepository.Create(user);
                Console.WriteLine($"Adding a user : {user.Id} {user.Name} {user.Email}\n");
                unitOfWork.Commit();
            }
            Console.WriteLine("Done.");
            Console.ReadKey();
        }