Beispiel #1
0
        public void WellSerialization()
        {
            var well = new Well(Guid.NewGuid(), "Main");

            well.Add(new Trajectory(Guid.NewGuid(), "1"));
            well.Add(new Trajectory(Guid.NewGuid(), "2"));
            well.Add(new Trajectory(Guid.NewGuid(), "3"));

            var document = BsonMapper.Global.ToDocument(well);
            var obj      = BsonMapper.Global.ToObject <Well>(document);
        }
Beispiel #2
0
        public void TrajectoryObservable()
        {
            Trajectory[] res;
            using (var db = new RealtimeLiteDatabase(new MemoryStream()))
                //using(var _ = db.Realtime.Collection<Trajectory>("trajectories").Subscribe(x => res = x))
                using (var _ = db.Realtime.Collection <Well>("wells")
                               .Select(x => x.SelectMany(w => w.Trajectories))
                               .Subscribe(x => res = x.ToArray()))
                {
                    var well = new Well(Guid.NewGuid(), "MainWell");
                    well.Add(new Trajectory(Guid.NewGuid(), "Traj1"));
                    var wells = db.GetCollection <Well>("wells");
                    wells.Insert(well);

                    well.Add(new Trajectory(Guid.NewGuid(), "Traj2"));
                    wells.Update(well);
                }
        }
Beispiel #3
0
        public void WellObservable()
        {
            List <Well> res;

            using (var db = new RealtimeLiteDatabase(new MemoryStream()))
                using (var _ = db.Realtime.Collection <Well>("wells")
                               .Subscribe(x => res = x))
                {
                    var well = new Well(Guid.NewGuid(), "MainWell");
                    well.Add(new Trajectory(Guid.NewGuid(), "Traj1"));

                    var wells = db.GetCollection <Well>("wells");
                    wells.Insert(well);

                    well.Add(new Trajectory(Guid.NewGuid(), "Traj2"));
                    wells.Update(well);
                }
        }
Beispiel #4
0
        public void QueryWithoutRefs()
        {
            using (var db = new RealtimeLiteDatabase(new MemoryStream()))
            {
                var main = new Well(Guid.NewGuid(), "MainWell");
                main.Add(new Trajectory(Guid.NewGuid(), "MainTraj"));
                var pilot = new Well(Guid.NewGuid(), "PilotWell");
                pilot.Add(new Trajectory(Guid.NewGuid(), "PilotTraj"));

                var wells = db.GetCollection <Well>("wells");
                wells.Insert(main);
                wells.Insert(pilot);

                var one       = wells.FindById(main.Key);
                var all       = wells.FindAll().ToArray();
                var names     = wells.Query().Select(x => x.Name).ToArray();
                var firstTraj = wells.Query().Select(x => x.Trajectories.First()).ToArray();
                var children1 = wells.Query().Select(x => x.Trajectories).ToArray();
                var children2 = wells.Query().Select("Trajectories").ToDocuments();
            }
        }