/// <summary> /// 转换成XmlElement /// </summary> /// <param name="sqlElement">要转换的对象</param> /// <param name="xmlParent">附加到的XmlElement</param> public override void ToXml(SqlElement sqlElement, XmlElement xmlParent) { base.ToXml(sqlElement, xmlParent); SubQuerySqlStatement selectSql = sqlElement as SubQuerySqlStatement; XmlElement xmlSelectList = SerializerUtil.AddElement(xmlParent, SelectFieldListStatement.SELECTLISTSTATEMENT); selectSql.SelectList.ToXml(selectSql.SelectList, xmlSelectList); XmlElement xmlFrom = SerializerUtil.AddElement(xmlParent, From.FROM); selectSql.From.ToXml(selectSql.From, xmlFrom); XmlElement xmlJoinCondition = SerializerUtil.AddElement(xmlParent, JoinConditionStatement.JOINCONDITIONSTATEMENT); selectSql.JoinCondition.ToXml(selectSql.JoinCondition, xmlJoinCondition); XmlElement xmlFilterCondition = SerializerUtil.AddElement(xmlParent, FILTERCONDITION); selectSql.FilterCondition.ToXml(selectSql.FilterCondition, xmlFilterCondition); XmlElement xmlOrderByCondition = SerializerUtil.AddElement(xmlParent, ORDERBYCONDITION); selectSql.OrderByCondition.ToXml(selectSql.OrderByCondition, xmlOrderByCondition); /* * MainFromItem只序列化,不反序列化。 * 其反序列化操作已包含在Froms的集合中,直接从集合中取即可。 * */ XmlElement xmlMainFromItem = SerializerUtil.AddElement(xmlParent, MAINFROMITEM); selectSql.MainFromItem.ToXml(selectSql.MainFromItem, xmlMainFromItem); }
public override void ToXml(SqlElement sqlElement, XmlElement xmlParent) { base.ToXml(sqlElement, xmlParent); SelectSqlForSubQuery subQuery = sqlElement as SelectSqlForSubQuery; XmlElement xmlFrom = SerializerUtil.AddElement(xmlParent, From.FROM); subQuery.From.ToXml(subQuery.From, xmlFrom); XmlElement xmlJoinCondition = SerializerUtil.AddElement(xmlParent, JoinConditionStatement.JOINCONDITIONSTATEMENT); subQuery.JoinCondition.ToXml(subQuery.JoinCondition, xmlJoinCondition); XmlElement xmlCondition = SerializerUtil.AddElement(xmlParent, ConditionStatement.CONDITIONSTATEMENT); subQuery.Condition.ToXml(subQuery.Condition, xmlCondition); /* * MainFromItem和JoinSubQueryConditionItem只序列化,不反序列化。 * 其反序列化操作已包含在From和JoinCondition的集合中,直接从集合中取即可。 * */ XmlElement xmlMainFromItem = SerializerUtil.AddElement(xmlParent, MAINFROMITEM); subQuery.MainFromItem.ToXml(subQuery.MainFromItem, xmlMainFromItem); XmlElement xmlJoinSubQueryConditionItem = SerializerUtil.AddElement(xmlParent, JOINSUBQUERYCONDITIONITEM); subQuery.JoinSubQueryConditionItem.ToXml(subQuery.JoinSubQueryConditionItem, xmlJoinSubQueryConditionItem); }
/// <summary> /// 由XmlElement转换成SqlElement /// </summary> /// <param name="sqlElement">附加到的SqlElement</param> /// <param name="xmlParent">反序列化的XmlElement</param> /// <param name="xnm">命名空间</param> public override void FromXml(SqlElement sqlElement, XmlElement xmlParent, XmlNamespaceManager xnm) { base.FromXml(sqlElement, xmlParent, xnm); SubQuerySqlStatement selectSql = sqlElement as SubQuerySqlStatement; ParserUtil util = new ParserUtil(xnm); XmlElement xmlSelectList = util.Child(xmlParent, SelectFieldListStatement.SELECTLISTSTATEMENT); XmlElement xmlFrom = util.Child(xmlParent, From.FROM); XmlElement xmlJoinCondition = util.Child(xmlParent, JoinConditionStatement.JOINCONDITIONSTATEMENT); XmlElement xmlFilterCondition = util.Child(xmlParent, FILTERCONDITION); XmlElement xmlOrderByCondition = util.Child(xmlParent, ORDERBYCONDITION); selectSql.SelectList.FromXml(selectSql.SelectList, xmlSelectList, xnm); selectSql.From.FromXml(selectSql.From, xmlFrom, xnm); selectSql.JoinCondition.FromXml(selectSql.JoinCondition, xmlJoinCondition, xnm); selectSql.FilterCondition.FromXml(selectSql.FilterCondition, xmlFilterCondition, xnm); selectSql.OrderByCondition.FromXml(selectSql.OrderByCondition, xmlOrderByCondition, xnm); /* * MainFromItem只序列化,不反序列化。 * 其反序列化操作已包含在Froms的集合中,直接从集合中取即可。 * */ selectSql.mainFromItem = this.From.ChildCollection[0] as FromItem; }
/// <summary> /// 获取SQLDOM元素类型 /// </summary> /// <param name="sqlElement">SQLDOM元素</param> /// <returns>SQLDOM元素类型</returns> public static int GetSqlElementType(SqlElement sqlElement) { SqlElementType elementType = SqlElementType.UnKnown; var type = sqlElement.GetType(); if (type == typeof(InsertField)) { elementType = SqlElementType.InsertField; } if (type == typeof(SqlPrimaryKeyField)) { elementType = SqlElementType.SqlPrimaryKeyField; } if (type == typeof(SelectListField)) { elementType = SqlElementType.SelectListField; } if (type == typeof(UpdateField)) { elementType = SqlElementType.UpdateField; } return((int)elementType); }
/// <summary> /// 用XmlElement的信息构造SqlElement类的对象(或继承自SqlElement类的对象)。 /// </summary> /// <param name="sqlNode">SqlElement类的对象(或继承自SqlElement类的对象)</param> /// <param name="xmlParent">XmlDocument中的元素</param> /// <param name="xnm">集合命名空间范围管理类的对象</param> public virtual void FromXml(SqlElement sqlNode, XmlElement xmlParent, XmlNamespaceManager xnm) { ParserUtil util = new ParserUtil(xnm); XmlElement xmlId = util.Child(xmlParent, ID); XmlElement xmlVersion = util.Child(xmlParent, VERSION); //sqlNode.Id = xmlId.InnerText; //sqlNode.Version = xmlVersion.InnerText; XmlElement xmlChildList = util.Child(xmlParent, CHILDCOLLECTION); if (xmlChildList != null) { XmlNodeList childNodeList = util.Children(xmlChildList, SQLELEMENT); if (childNodeList != null) { sqlNode.CreateChildCollection(); foreach (XmlElement xmlChildNode in childNodeList) { //// 通过反射构造对象。 //string fullname = util.AttrStr(xmlChildNode, CLASSFULLNAME); //Assembly ass = Assembly.GetExecutingAssembly(); //SqlElement node = ass.CreateInstance(fullname) as SqlElement; int sqlElementType = util.AttrInt(xmlChildNode, SQLELEMENTTYPE); SqlElement node = SqlElementFactory.GetSQLElement(sqlElementType); node.FromXml(node, xmlChildNode, xnm); sqlNode.ChildCollection.Add(node); } } } }
public override void ToXml(SqlElement sqlElement, XmlElement xmlParent) { base.ToXml(sqlElement, xmlParent); SelectListField selectListField = sqlElement as SelectListField; XmlElement xmlFieldAlias = SerializerUtil.AddElement(xmlParent, FIELDALIAS, selectListField.FieldAlias); }
public override void FromXml(SqlElement sqlNode, XmlElement xmlParent, XmlNamespaceManager xnm) { base.FromXml(sqlNode, xmlParent, xnm); SqlStatement sqlStatement = sqlNode as SqlStatement; ParserUtil util = new ParserUtil(xnm); XmlElement xmlTableName = util.Child(xmlParent, TABLENAME); XmlElement xmlTableCode = util.Child(xmlParent, TABLECODE); XmlElement xmlCOID = util.Child(xmlParent, COMMONOBJECTID); XmlElement xmlNodeObjectID = util.Child(xmlParent, NODEOBJECTID); XmlElement xmlCOVersion = util.Child(xmlParent, COMMONOBJECTVERSION); XmlElement xmlNodeObjectVersion = util.Child(xmlParent, NODEOBJECTVERSION); sqlStatement.TableName = xmlTableName.InnerText; sqlStatement.TableCode = xmlTableCode.InnerText; sqlStatement.CommonObjectID = xmlCOID.InnerText; sqlStatement.NodeID = xmlNodeObjectID.InnerText; //sqlStatement.CommonObjectVersion = xmlCOVersion.InnerText; //sqlStatement.NodeVersion = xmlNodeObjectVersion.InnerText; XmlElement xmlPrimaryKeyField = util.Child(xmlParent, SqlPrimaryKey.SQLPRIMARYKEY); sqlStatement.PrimaryKeys.FromXml(sqlStatement.PrimaryKeys, xmlPrimaryKeyField, xnm); }
/// <summary> /// 将SqlNode的属性写入XmlElement。 /// </summary> /// <param name="sqlElement">SqlNode类的对象(或继承自SqlNode类的对象)</param> /// <param name="xmlParent">XmlDocument中的元素</param> public override void ToXml(SqlElement sqlElement, XmlElement xmlParent) { base.ToXml(sqlElement, xmlParent); FromItem fromItem = sqlElement as FromItem; XmlElement xmlTable = SerializerUtil.AddElement(xmlParent, SqlTable.TABLE); fromItem.Table.ToXml(fromItem.Table, xmlTable); }
public override void ToXml(SqlElement sqlElement, XmlElement xmlParent) { // 先处理基类 base.ToXml(sqlElement, xmlParent); SqlTable table = sqlElement as SqlTable; XmlElement tableNameElement = SerializerUtil.AddElement(xmlParent, TABLENAME, table.TableName); XmlElement tableAliasElement = SerializerUtil.AddElement(xmlParent, TABLEALIAS, table.TableAlias); XmlElement realTableNameElement = SerializerUtil.AddElement(xmlParent, REALTABLENAME, table.RealTableName); }
public override void FromXml(SqlElement sqlElement, XmlElement xmlParent, XmlNamespaceManager xnm) { base.FromXml(sqlElement, xmlParent, xnm); SelectListField selectListField = sqlElement as SelectListField; ParserUtil util = new ParserUtil(xnm); XmlElement xmlFieldAlias = util.Child(xmlParent, FIELDALIAS); selectListField.FieldAlias = xmlFieldAlias.InnerText; }
/// <summary> /// 用XmlElement的信息构造SqlNode类的对象(或继承自SqlNode类的对象)。 /// </summary> /// <param name="sqlElement">SqlNode类的对象(或继承自SqlNode类的对象)</param> /// <param name="xmlParent">XmlDocument中的元素</param> /// <param name="xnm">集合命名空间范围管理类的对象</param> public override void FromXml(SqlElement sqlElement, XmlElement xmlParent, XmlNamespaceManager xnm) { base.FromXml(sqlElement, xmlParent, xnm); FromItem fromItem = sqlElement as FromItem; ParserUtil util = new ParserUtil(xnm); XmlElement xmlTable = util.Child(xmlParent, SqlTable.TABLE); fromItem.Table.FromXml(fromItem.Table, xmlTable, xnm); }
/// <summary> /// 克隆 /// </summary> /// <returns>Sql元素</returns> public virtual object Clone() { SqlElement newSqlElement = this.MemberwiseClone() as SqlElement; if (childCollection != null) { newSqlElement.childCollection = this.childCollection.Clone() as SqlElementCollection; } return(newSqlElement); }
public override void ToXml(SqlElement sqlElement, XmlElement xmlParent) { base.ToXml(sqlElement, xmlParent); LeftJoinItem leftJoinItem = sqlElement as LeftJoinItem; XmlElement xmlLeftJoinTable = SerializerUtil.AddElement(xmlParent, LEFTJOINTABLE); leftJoinItem.LeftJoinTable.ToXml(leftJoinItem.LeftJoinTable, xmlLeftJoinTable); XmlElement xmlAddtionalCondition = SerializerUtil.AddElement(xmlParent, ADDITIONALCONDITION, leftJoinItem.AdditionalCondition); }
/// <summary> /// 转换成Insert语句 /// </summary> /// <param name="sqlElement">SQL元素</param> /// <param name="xmlParent">XML父节点元素</param> /// <param name="xnm">集合命名空间范围管理类的对象</param> public override void FromXml(SqlElement sqlElement, XmlElement xmlParent, XmlNamespaceManager xnm) { base.FromXml(sqlElement, xmlParent, xnm); var xnm2 = new XmlNamespaceManager(xmlParent.OwnerDocument.NameTable); InsertSqlStaMSS insertSql = sqlElement as InsertSqlStaMSS; ParserUtil util = new ParserUtil(xnm); XmlElement xmlInsertFields = util.Child(xmlParent, InsertFieldList.INSERTFIELDLIST); //XmlElement xmlInsertValues = util.Child(xmlParent, InsertValueList.INSERTVALUELIST); insertSql.InsertFields.FromXml(insertSql.InsertFields, xmlInsertFields, xnm); //insertSql.InsertValues.FromXml(insertSql.InsertValues, xmlInsertValues, xnm); }
/// <summary> /// 转换成XML /// </summary> /// <param name="sqlElement">SQL元素</param> /// <param name="xmlParent">XML父节点元素</param> public override void ToXml(SqlElement sqlElement, XmlElement xmlParent) { base.ToXml(sqlElement, xmlParent); InsertSqlStaMSS insertSql = sqlElement as InsertSqlStaMSS; XmlElement xmlInsertFields = SerializerUtil.AddElement(xmlParent, InsertFieldList.INSERTFIELDLIST); insertSql.InsertFields.ToXml(insertSql.InsertFields, xmlInsertFields); //不需要对FieldValue序列化 //XmlElement xmlInsertValues = SerializerUtil.AddElement(xmlParent, InsertValueList.INSERTVALUELIST); //insertSql.InsertValues.ToXml(insertSql.InsertValues, xmlInsertValues); }
public override void ToXml(SqlElement sqlElement, XmlElement xmlParent) { base.ToXml(sqlElement, xmlParent); UpdateSqlStatement updateSql = sqlElement as UpdateSqlStatement; XmlElement xmlUpdateFields = SerializerUtil.AddElement(xmlParent, UpdateFieldList.UPDATEFIELDLIST); updateSql.UpdateFields.ToXml(updateSql.UpdateFields, xmlUpdateFields); XmlElement xmlUpdateCondition = SerializerUtil.AddElement(xmlParent, UPDATECONDITION); updateSql.UpdateCondition.ToXml(updateSql.UpdateCondition, xmlUpdateCondition); }
public override void ToXml(SqlElement sqlElement, XmlElement xmlParent) { base.ToXml(sqlElement, xmlParent); DeleteSqlStatement deleteSql = sqlElement as DeleteSqlStatement; XmlElement xmlCondition = SerializerUtil.AddElement(xmlParent, ConditionStatement.CONDITIONSTATEMENT); deleteSql.Condition.ToXml(deleteSql.Condition, xmlCondition); if (deleteSql.SubQuerySql != null)// SubQuerySql 可以为空 { XmlElement xmlSubQuerySql = SerializerUtil.AddElement(xmlParent, SUBQUERYSQL); deleteSql.SubQuerySql.ToXml(deleteSql.SubQuerySql, xmlSubQuerySql); } }
public override void ToXml(SqlElement sqlElement, XmlElement xmlParent) { base.ToXml(sqlElement, xmlParent); JoinConditionItem joinConditionItem = sqlElement as JoinConditionItem; XmlElement xmlLeftField = SerializerUtil.AddElement(xmlParent, LEFTFIELD); joinConditionItem.LeftField.ToXml(joinConditionItem.LeftField, xmlLeftField); XmlElement xmlRightField = SerializerUtil.AddElement(xmlParent, RIGHTFIELD); joinConditionItem.RightField.ToXml(joinConditionItem.RightField, xmlRightField); }
/// <summary> /// 根据SQLDOM元素类型初始化SQLDOM元素对象 /// </summary> /// <param name="sqlElementType">SQLDOM元素类型</param> /// <returns>SQLDOM元素对象</returns> public static SqlElement GetSQLElement(int sqlElementType) { SqlElement element = null; SqlElementType type = (SqlElementType)sqlElementType; switch (type) { case SqlElementType.InsertField: element = new InsertField(); break; case SqlElementType.SqlPrimaryKeyField: element = new SqlPrimaryKeyField(); break; case SqlElementType.SelectListField: element = new SelectListField(); break; case SqlElementType.UpdateField: element = new UpdateField(); break; case SqlElementType.From: element = new From(); break; case SqlElementType.FromItem: element = new FromItem(); break; case SqlElementType.JoinCondition: element = new JoinConditionStatement(); break; case SqlElementType.OrderByCondition: element = new ConditionStatement(); break; case SqlElementType.FilterCondition: element = new ConditionStatement(); break; case SqlElementType.UnKnown: break; } return(element); }
public override void FromXml(SqlElement sqlElement, XmlElement xmlParent, XmlNamespaceManager xnm) { base.FromXml(sqlElement, xmlParent, xnm); LeftJoinItem leftJoinItem = sqlElement as LeftJoinItem; ParserUtil util = new ParserUtil(xnm); XmlElement xmlLeftJoinTable = util.Child(xmlParent, LEFTJOINTABLE); leftJoinItem.LeftJoinTable.FromXml(leftJoinItem.LeftJoinTable, xmlLeftJoinTable, xnm); XmlElement xmlAddtionalCondition = util.Child(xmlParent, ADDITIONALCONDITION); leftJoinItem.AdditionalCondition = xmlAddtionalCondition.InnerText; }
/// <summary> /// 转换成XML /// </summary> /// <param name="sqlElement">SQL元素</param> /// <param name="xmlParent">XML父节点元素</param> public override void ToXml(SqlElement sqlElement, XmlElement xmlParent) { base.ToXml(sqlElement, xmlParent); Field field = sqlElement as Field; if (field.Table != null)// Table 可以为空 { XmlElement xmlTable = SerializerUtil.AddElement(xmlParent, SqlTable.TABLE); field.Table.ToXml(field.Table, xmlTable); } SerializerUtil.AddElement(xmlParent, FIELDNAME, field.FieldName); SerializerUtil.AddElement(xmlParent, ISUSEFIELDPREFIX, field.IsUseFieldPrefix.ToString()); }
public override void FromXml(SqlElement sqlElement, XmlElement xmlParent, XmlNamespaceManager xnm) { base.FromXml(sqlElement, xmlParent, xnm); JoinConditionItem joinConditionItem = sqlElement as JoinConditionItem; ParserUtil util = new ParserUtil(xnm); XmlElement xmlLeftField = util.Child(xmlParent, LEFTFIELD); joinConditionItem.LeftField.FromXml(joinConditionItem.LeftField, xmlLeftField, xnm); XmlElement xmlRightField = util.Child(xmlParent, RIGHTFIELD); joinConditionItem.RightField.FromXml(joinConditionItem.RightField, xmlRightField, xnm); }
public override void FromXml(SqlElement sqlElement, XmlElement xmlParent, XmlNamespaceManager xnm) { base.FromXml(sqlElement, xmlParent, xnm); UpdateSqlStatement updateSql = sqlElement as UpdateSqlStatement; ParserUtil util = new ParserUtil(xnm); XmlElement xmlUpdateFields = util.Child(xmlParent, UpdateFieldList.UPDATEFIELDLIST); updateSql.UpdateFields.FromXml(updateSql.UpdateFields, xmlUpdateFields, xnm); XmlElement xmlUpdateCondition = util.Child(xmlParent, UPDATECONDITION); updateSql.UpdateCondition.FromXml(updateSql.UpdateCondition, xmlUpdateCondition, xnm); }
public override void ToXml(SqlElement sqlElement, XmlElement xmlParent) { base.ToXml(sqlElement, xmlParent); SqlStatement sqlStatement = sqlElement as SqlStatement; XmlElement xmlTableName = SerializerUtil.AddElement(xmlParent, TABLENAME, sqlStatement.TableName); XmlElement xmlTableCode = SerializerUtil.AddElement(xmlParent, TABLECODE, sqlStatement.TableCode); XmlElement xmlCOID = SerializerUtil.AddElement(xmlParent, COMMONOBJECTID, sqlStatement.CommonObjectID); XmlElement xmlNodeObjectID = SerializerUtil.AddElement(xmlParent, NODEOBJECTID, sqlStatement.NodeID); XmlElement xmlCOVersion = SerializerUtil.AddElement(xmlParent, COMMONOBJECTVERSION, sqlStatement.CommonObjectVersion); XmlElement xmlNodeObjectVersion = SerializerUtil.AddElement(xmlParent, NODEOBJECTVERSION, sqlStatement.NodeVersion); XmlElement xmlPrimaryKeyField = SerializerUtil.AddElement(xmlParent, SqlPrimaryKey.SQLPRIMARYKEY); sqlStatement.PrimaryKeys.ToXml(sqlStatement.PrimaryKeys, xmlPrimaryKeyField); }
public override void FromXml(SqlElement sqlElement, XmlElement xmlParent, XmlNamespaceManager xnm) { base.FromXml(sqlElement, xmlParent, xnm); DeleteSqlStatement deleteSql = sqlElement as DeleteSqlStatement; ParserUtil util = new ParserUtil(xnm); XmlElement xmlCondition = util.Child(xmlParent, ConditionStatement.CONDITIONSTATEMENT); deleteSql.Condition.FromXml(deleteSql.Condition, xmlCondition, xnm); XmlElement xmlSubQuerySql = util.Child(xmlParent, SUBQUERYSQL); if (xmlSubQuerySql != null) { deleteSql.SubQuerySql = new SelectSqlForSubQuery(); deleteSql.SubQuerySql.FromXml(deleteSql.SubQuerySql, xmlSubQuerySql, xnm); } }
/// <summary> /// 转换成Insert语句 /// </summary> /// <param name="sqlNode">SQL元素</param> /// <param name="xmlParent">XML父节点元素</param> /// <param name="xnm">集合命名空间范围管理类的对象</param> public override void FromXml(SqlElement sqlNode, XmlElement xmlParent, XmlNamespaceManager xnm) { base.FromXml(sqlNode, xmlParent, xnm); Field field = sqlNode as Field; ParserUtil util = new ParserUtil(xnm); XmlElement xmlTable = util.Child(xmlParent, SqlTable.TABLE); if (xmlTable != null) { field.Table.FromXml(field.Table, xmlTable, xnm); } XmlElement xmlFieldName = util.Child(xmlParent, FIELDNAME); XmlElement xmlIsUseFieldPrefix = util.Child(xmlParent, ISUSEFIELDPREFIX); field.FieldName = xmlFieldName.InnerText; field.IsUseFieldPrefix = bool.Parse(xmlIsUseFieldPrefix.InnerText); }
/// <summary> /// 将SqlElement的属性写入XmlElement。 /// </summary> /// <param name="sqlNode">SqlElement类的对象(或继承自SqlElement类的对象)</param> /// <param name="xmlParent">XmlDocument中的元素</param> public virtual void ToXml(SqlElement sqlNode, XmlElement xmlParent) { //XmlElement xmlId = SerializerUtil.AddElement(xmlParent, ID, sqlNode.Id); //XmlElement xmlVersion = SerializerUtil.AddElement(xmlParent, VERSION, sqlNode.Version); if (sqlNode.ChildCollection != null) { XmlElement xmlchildList = SerializerUtil.AddElement(xmlParent, CHILDCOLLECTION); foreach (SqlElement childNode in sqlNode.ChildCollection) { XmlElement childNodeElement = SerializerUtil.AddElement(xmlchildList, SQLELEMENT); /* * FullName:一个包含 Type 的完全限定名的字符串,其中包括 Type 的命名空间但不包括程序集; * 例如,C# 字符串类型的完全限定名为 System.String。 * */ //childNodeElement.SetAttribute(CLASSFULLNAME, childNode.GetType().FullName); childNodeElement.SetAttribute(SQLELEMENTTYPE, SqlElementFactory.GetSqlElementType(childNode).ToString()); childNode.ToXml(childNode, childNodeElement); } } }
public override void FromXml(SqlElement sqlElement, XmlElement xmlParent, XmlNamespaceManager xnm) { base.FromXml(sqlElement, xmlParent, xnm); ParserUtil util = new ParserUtil(xnm); XmlElement tableNameElement = util.Child(xmlParent, TABLENAME); XmlElement tableAliasElement = util.Child(xmlParent, TABLEALIAS); XmlElement realTableNameElement = util.Child(xmlParent, REALTABLENAME); if (tableNameElement != null) { (sqlElement as SqlTable).TableName = tableNameElement.InnerText; } if (tableAliasElement != null) { (sqlElement as SqlTable).TableAlias = tableAliasElement.InnerText; } if (realTableNameElement != null) { (sqlElement as SqlTable).RealTableName = realTableNameElement.InnerText; } }
public override void FromXml(SqlElement sqlElement, XmlElement xmlParent, XmlNamespaceManager xnm) { base.FromXml(sqlElement, xmlParent, xnm); SelectSqlForSubQuery subQuery = sqlElement as SelectSqlForSubQuery; ParserUtil util = new ParserUtil(xnm); XmlElement xmlFrom = util.Child(xmlParent, From.FROM); XmlElement xmlJoinCondition = util.Child(xmlParent, JoinConditionStatement.JOINCONDITIONSTATEMENT); XmlElement xmlCondition = util.Child(xmlParent, ConditionStatement.CONDITIONSTATEMENT); subQuery.From.FromXml(subQuery.From, xmlFrom, xnm); subQuery.JoinCondition.FromXml(subQuery.JoinCondition, xmlJoinCondition, xnm); subQuery.Condition.FromXml(subQuery.Condition, xmlCondition, xnm); /* * MainFromItem和JoinSubQueryConditionItem只序列化,不反序列化。 * 其反序列化操作已包含在From和JoinCondition的集合中,直接从集合中取即可。 * */ subQuery.mainFromItem = this.From.ChildCollection[0] as FromItem; subQuery.joinSubQueryConditionItem = this.JoinCondition.ChildCollection[0] as JoinConditionItem; }