コード例 #1
0
ファイル: Program.cs プロジェクト: kunzimariano/MongoDB
        private static void InsertSampleData(MongoCollection<User> collection)
        {
            var user = new User { Username = "******", Email = "*****@*****.**", Tags = new List<string> { "uno", "dos", "tres" } };
            user.Addresses = new List<Address>
            {
                new Address() {City = "NY", State = "NY", Street = "Somewhere"},
                new Address() {City = "DC", State = "DC", Street = "Somewhere else"}
            };

            collection.Insert(user);

            user = new User { Username = "******", Email = "*****@*****.**", Tags = new List<string> { "uno", "dos" } };
            user.Addresses = new List<Address>
            {
                new Address() {City = "NY", State = "NY", Street = "Somewhere"},
            };

            collection.Insert(user);

            user = new User { Username = "******", Email = "*****@*****.**", Tags = new List<string> { "dos", "tres" } };
            user.Addresses = new List<Address>
            {
                new Address() {City = "DC", State = "DC", Street = "nowhere"}
            };

            collection.Insert(user);
        }
コード例 #2
0
ファイル: MainClass.cs プロジェクト: casmb200/CSharpStudy
        /// <summary>
        /// ユーザーオブジェクトテスト
        /// </summary>
        public static void UserTest1()
        {
            Console.WriteLine("[開始] {0}", MethodBase.GetCurrentMethod().Name);

            User user1 = new User();
            User user2 = new User();
            user1.id = "001";
            user1.name = "yamada";
            user2.id = "002";
            user2.name = "itou";
            UserDisp(user1);
            UserDisp(user2);

            Console.WriteLine("[終了] {0}\n", MethodBase.GetCurrentMethod().Name);
        }
コード例 #3
0
ファイル: MainClass.cs プロジェクト: casmb200/CSharpStudy
 /// <summary>
 /// ユーザーオブジェクト表示
 /// </summary>
 /// <param name="user"></param>
 private static void UserDisp(User user)
 {
     Console.WriteLine("user:{0}, name:{1}", user.id, user.name);
 }