Esempio n. 1
0
        static void Main()
        {
            Company c = new Company { Name = "Hazelcom Ltd" };

            c.Add(new Employee("Nicholas"));						// Constructs Employee with default Age value
            c.Add(new Employee { Name = "Tom" });
            c.Add(new Employee { Name = "Dick", Age = 20 });
            c.Add(new Employee { Name = "Harry", Age = 30 });
            c.Add(new Employee());

            for (int i = 0; i < c.Count; i++)
            {
                Console.WriteLine(c[i]);
            }

            Console.ReadLine();
        }
Esempio n. 2
0
        private static void CreateData(IDocumentStore store)
        {
            using (var session = store.OpenSession())
            {
                var company1 = new Company
                {
                    Name = "first",
                    City = "Tokyo"
                };
                session.Store(company1);
                var company2 = new Company
                {
                    Name = "second",
                    City = "Stockholm"
                };
                session.Store(company2);

                session.Store(new Invoice
                {
                    Amount = 5,
                    CompanyId = company1.Id
                });
                session.Store(new Invoice
                {
                    Amount = 4,
                    CompanyId = company1.Id
                });
                session.Store(new Invoice
                {
                    Amount = 25,
                    CompanyId = company2.Id
                });
                session.Store(new Invoice
                {
                    Amount = 15,
                    CompanyId = company2.Id
                });
                session.SaveChanges();
            }
        }