Example #1
0
        public void DeleteData(WorkInfo workInfo)
        {
            DbVisitor    db     = new DbVisitor();
            IDbSqlScheme scheme = db.CreateSqlFrom(SqlFromUnit.Me.From(workInfo));

            scheme.dbSqlBody.Where(ConditionItem.Me.And("id", ConditionRelation.Equals, workInfo.id));
            scheme.Delete();
        }
Example #2
0
        public void InsertData(WorkInfo workInfo)
        {
            DbVisitor    db     = new DbVisitor();
            IDbSqlScheme scheme = db.CreateSqlFrom(SqlFromUnit.Me.From(workInfo));

            scheme.dbSqlBody.DataOperateExcludes("id", "employeeInfo");
            scheme.Insert();
        }
Example #3
0
        public void UpdateData(WorkInfo workInfo)
        {
            DbVisitor    db     = new DbVisitor();
            IDbSqlScheme scheme = db.CreateSqlFrom(SqlFromUnit.Me.From(workInfo));

            scheme.dbSqlBody.DataOperateContains("CompanyName", "CompanyNameEn");
            scheme.Update();
        }
Example #4
0
        public void Query()
        {
            DbVisitor    db     = new DbVisitor();
            IDbSqlScheme scheme = db.CreateSqlFrom(SqlFromUnit.New.From <WorkInfo>(dm => dm.CompanyName.Equals("HG")));

            scheme.dbSqlBody.Where(ConditionItem.Me.And("CompanyName", ConditionRelation.Contain, "G"));

            IList <WorkInfo> list = scheme.ToList <WorkInfo>();

            //实现懒加载
            EmployeeInfo     employeeInfo1 = list[0].employeeInfo;
            IList <WorkInfo> workInfos1    = employeeInfo1.WorkInfos;
            EmployeeInfo     employeeInfo2 = workInfos1[0].employeeInfo;
        }