Exemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        dbUtil = DbUtil.getInstance();
        dbUtil.CreateTable(new TestSkill());//建表
        dbUtil.CreateTable(new TestCharactor());

        dbUtil.Insert(new TestSkill()
        {
            skillID = 1, skillName = "技能1"
        });                                                              //插入

        c1 = new TestCharactor();
        c1.charactorName = "c1";
        dbUtil.Insert(c1);

        List <TestSkill>     penList    = new List <TestSkill>();
        List <TestCharactor> personList = new List <TestCharactor>();

        for (int i = 5; i < 20; i++)
        {
            TestSkill pen = new TestSkill()
            {
                skillID = i, skillName = "shill" + i.ToString()
            };
            TestCharactor person = new TestCharactor()
            {
                charactorName = "charactor " + i.ToString()
            };
            personList.Add(person);
            penList.Add(pen);
        }
        dbUtil.InsertList(penList);//插入链表
        dbUtil.InsertList(personList);



        // dbUtil.CloseConnection();
    }