Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            try
            {
                YoIt f**k = new YoIt();
                f**k.Yo();

                DbInitializationTools.DbInitializerStrategyFactory("CreateIfChanged");

                Console.WriteLine("Clear database?");
                var instruction = Console.ReadKey();
                if (instruction.Key == ConsoleKey.Y)
                {
                    using (var context = new NoSQLContext())
                    {
                        context.Database.ExecuteSqlCommand("Delete from Store");
                        context.Database.ExecuteSqlCommand("Delete from typeversion");
                        context.Database.ExecuteSqlCommand("Delete from StoreArchive");
                    }
                }

                //DoIt();
                //MigrationsFuck();
                //return;

                // Temp test of the system
                Guid id1, id2;
                using (var context = new NoSQLContext())
                {
                    NoSqlRepository s = new NoSqlRepository(context);

                    id1 = s.Create(@"P&P test 1");
                    id2 = s.Create(@"P&P test 2");

                    context.SaveChanges();
                }

                using (var context = new NoSQLContext())
                {
                    NoSqlRepository <string> s = new NoSqlRepository <string>(context);

                    var foo = s.Retrieve(id1);
                    var bar = s.Retrieve(id2);

                    Console.WriteLine(foo);
                    Console.WriteLine(bar);
                }

                using (var store = new Store())
                {
                    var one = BuildMeOne();

                    store.Create(one);

                    store.SaveChanges();
                }

                using (var store = new Store())
                {
                    var readBack = store.TryRetrieve <SimplePoco>(new Guid("DA722261-062C-43DF-B64C-B17829A58440"));

                    var yo = 3334;
                }
            }
            catch (Exception ex)
            {
                Console.Write(ex.ToString());
            }

            Console.ReadKey();
        }