コード例 #1
0
        public static void Test()
        {
            try
            {
                System.IO.Directory.Delete(Environment.CurrentDirectory + "/DB", true);
            }
            catch { }

            var Person_Table = new Monsajem_Incs.Database.DirectoryTable.DirectoryTable <Person, string>(
                Environment.CurrentDirectory + "/DB", (c) => c.name, false, true);

            Person_Table.Relation((c) => c.frinds, (c) => c.IsUpdateAble = false).Join();

            new Client().Connect(new System.Net.IPEndPoint(System.Net.IPAddress.Loopback, 8989),
                                 (Link) =>
            {
                Link.GetUpdate(Person_Table); //1 // get Items
                Link.GetUpdate(Person_Table); //2 // get Items
                Link.GetUpdate(Person_Table); //3 // New Items
                Link.GetUpdate(Person_Table); //4 // Delete Items
                Link.GetUpdate(Person_Table); //5 // New Items
                var Ali = Person_Table.GetItem("ali").Value;
                Link.GetUpdate(Ali.frinds);   //6
                var ahmad = Person_Table.GetItem("ahmad").Value;
                Link.GetUpdate(ahmad.frinds); //7
                Ali = Person_Table.GetItem("ali").Value;
                Link.GetUpdate(Ali.frinds);   //8
                ahmad = Person_Table.GetItem("ahmad").Value;
                Link.GetUpdate(ahmad.frinds); //9
                Ali = Person_Table.GetItem("ali").Value;
                Link.GetUpdate(Ali.frinds);   //10
            });
        }
コード例 #2
0
        public static void Test()
        {
            try
            {
                System.IO.Directory.Delete(Environment.CurrentDirectory + "/DB", true);
            }
            catch {}

            var Table_Person = new Monsajem_Incs.Database.DirectoryTable.DirectoryTable <Person, string>(
                Environment.CurrentDirectory + "/DB", (c) => c.name, true, true);

            Table_Person.Relation((c) => c.frinds, (c) => c.IsUpdateAble = true).Join();

            Table_Person.Insert(new Person()
            {
                name = "ali"
            });
            Table_Person.Insert(new Person()
            {
                name = "reza"
            });

            //{
            //    Table_Person.Insert((c) => c.name = "ahmad");
            //    Table_Person.Insert((c) => c.name = "akbar");
            //    Table_Person.Delete("ahmad");
            //    Table_Person.Insert((c) => c.name = "ahmad");
            //    Table_Person["ali"].Value.frinds.Accept("ahmad");
            //    Table_Person["ali"].Value.frinds.Accept("akbar");

            //    var Ali1 = Table_Person.GetItem("ali").Value.frinds.UpdateAble["akbar"];
            //    var ahmad1 = Table_Person.UpdateAble["akbar"];

            //    Table_Person.Update("akbar", (c) => { });
            //    var Ali = Table_Person.GetItem("ali").Value.frinds.UpdateAble["akbar"];
            //    var ahmad = Table_Person.UpdateAble["akbar"];
            //}

            var Server = new Server();

            Server.StartServicing(new System.Net.IPEndPoint(System.Net.IPAddress.Loopback, 8989),
                                  (Link) =>
            {
                Link.SendUpdate(Table_Person); //1
                Link.SendUpdate(Table_Person); //2

                Table_Person.Insert((c) => c.name = "ahmad");
                Table_Person.Insert((c) => c.name = "akbar");

                Link.SendUpdate(Table_Person);//3

                Table_Person.Delete("ahmad");

                Link.SendUpdate(Table_Person);//4

                Table_Person.Insert((c) => c.name = "ahmad");

                Link.SendUpdate(Table_Person);//5

                var Ali   = Table_Person.GetItem("ali").Value;
                var ahmad = Table_Person.GetItem("ahmad").Value;
                Ali.frinds.Accept("ahmad");
                Ali.frinds.Accept("akbar");
                Ali   = Table_Person.GetItem("ali").Value;
                ahmad = Table_Person.GetItem("ahmad").Value;
                Link.SendUpdate(Ali.frinds);   //6
                Link.SendUpdate(ahmad.frinds); //7
                Link.SendUpdate(Ali.frinds);   //8
                Link.SendUpdate(ahmad.frinds); //9

                Ali = Table_Person.GetItem("ali").Value;
                Ali.frinds.Ignore("ahmad");
                Ali = Table_Person.GetItem("ali").Value;
                Link.SendUpdate(Ali.frinds);//10
            });

            Console.ReadKey();
        }