コード例 #1
0
        private void InsertSecond()
        {
            var root = new RootDescended
            {
                A = "Amazing",
                B = "Baby",
                C = new C
                {
                    D = "Donkey Kong",
                    E = new E
                    {
                        F = 111,
                        H = 222,
                        I = new[] { "itchy" }
                    }
                },
                G = new[] {
                    new C
                    {
                        D = "Donald",
                        E = new E
                        {
                            F = 333,
                            H = 444,
                            I = new [] { "igloo" }
                        }
                    },
                    new C
                    {
                        D = "Durango",
                        E = new E
                        {
                            F = 555,
                            H = 666,
                            I = new [] { "icy" }
                        }
                    }
                },
                Id = 20,
                J  = new DateTime(2011, 12, 1, 13, 14, 15, 16, DateTimeKind.Utc),
                K  = false,
                L  = new HashSet <int>(new[] { 2, 3, 4 }),
                M  = new[] { 3, 5, 6 },
                O  = new List <long> {
                    100, 200, 300
                },
                P = 1.1,
                U = -1.234565723762724332233489m,
                Z = 10
            };

            __collection.InsertOne(root);
        }
コード例 #2
0
 private void InsertSecond()
 {
     var root = new RootDescended
     {
         A = "Amazing",
         B = "Baby",
         C = new C
         {
             D = "Donkey Kong",
             E = new E
             {
                 F = 111,
                 H = 222,
                 I = new[] { "itchy" }
             }
         },
         G = new[] { 
                 new C
                 {
                     D = "Donald",
                     E = new E
                     {
                         F = 333,
                         H = 444,
                         I = new [] { "igloo" }
                     }
                 },
                 new C
                 {
                     D = "Durango",
                     E = new E
                     {
                         F = 555,
                         H = 666,
                         I = new [] { "icy" }
                     }
                 }
         },
         Id = 20,
         J = new DateTime(2011, 12, 1, 13, 14, 15, 16, DateTimeKind.Utc),
         K = false,
         L = new HashSet<int>(new[] { 2, 3, 4 }),
         M = new[] { 3, 5, 6 },
         O = new List<long> { 100, 200, 300 },
         P = 1.1,
         U = 1.234565723762724332233489m
     };
     _collection.InsertOneAsync(root).GetAwaiter().GetResult();
 }