Esempio n. 1
0
        static void Main(string[] args)
        {
            using (var db = new ItemCatalog())
            {
                var member = new Member
                {
                    Name    = "thinkAmi",
                    Address = "SQLServerCompact4"
                };
                db.Members.Add(member);


                var item = new Item
                {
                    Name   = "シナノドルチェ",
                    Member = member
                };
                db.Items.Add(item);

                int recordAffected = db.SaveChanges();


                db.Items.Select(i => i).ToList().ForEach(row => Console.WriteLine("Id: {0}, Name: {1}, Member Name: {2}, Address: {3}", row.Id, row.Name, row.Member.Name, row.Member.Address));
                Console.ReadKey();
            }
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            using (var db = new ItemCatalog())
            {
                var member = new Member
                {
                    Name = "thinkAmi",
                    Address = "SQLServerCompact4"
                };
                db.Members.Add(member);


                var item = new Item
                {
                    Name = "シナノドルチェ",
                    Member = member
                };
                db.Items.Add(item);

                int recordAffected = db.SaveChanges();


                db.Items.Select(i => i).ToList().ForEach(row => Console.WriteLine("Id: {0}, Name: {1}, Member Name: {2}, Address: {3}", row.Id, row.Name, row.Member.Name, row.Member.Address));
                Console.ReadKey();
            }
        }