예제 #1
0
 static void StoreTea(Tea tea)
 {
     using (var ds = new DocumentStore { Url = DATABASEURL }.Initialize())
     {
         using (var session = ds.OpenSession(DATABASE))
         {
             session.Store(tea);
             session.SaveChanges();
             Console.WriteLine(tea.Id);
         }
     }
 }
예제 #2
0
        static void Main(string[] args)
        {
            Tea tea = new Tea() { Name = "Earl Grey", TeaType = TeaType.Black, WaterTemp = 99, SleepTime = 3 };

            StoreTea(tea);

            Console.WriteLine(tea.Id + "--" + tea.Name);

            tea = LoadTea("teas/1");

            Console.WriteLine(tea.Id + "--" + tea.Name);

            foreach (Tea dbTea in ListTeasByType(TeaType.Black))
            {
                Console.WriteLine(dbTea.Name);
            }

            Console.ReadLine();
        }