static bool ExistTableAlias(DbMainTableExpression mainTable, string alias) { if (string.Equals(mainTable.Table.Alias, alias, StringComparison.OrdinalIgnoreCase)) { return(true); } foreach (DbJoinTableExpression joinTable in mainTable.JoinTables) { if (ExistTableAlias(joinTable, alias)) { return(true); } } return(false); }
public virtual IObjectModel ToNewObjectModel(DbSqlQueryExpression sqlQuery, DbTable table, DbMainTableExpression dependentTable, bool ignoreFilters) { throw new NotImplementedException(); }
public override IObjectModel ToNewObjectModel(DbSqlQueryExpression sqlQuery, DbTable table, DbMainTableExpression dependentTable, bool ignoreFilters) { DbColumnAccessExpression cae = ObjectModelHelper.ParseColumnAccessExpression(sqlQuery, table, this.Expression); PrimitiveObjectModel objectModel = new PrimitiveObjectModel(this.ObjectType, cae); objectModel.NullChecking = ObjectModelHelper.TryGetOrAddNullChecking(sqlQuery, table, this.NullChecking); return(objectModel); }
public IObjectModel ToNewObjectModel(DbSqlQueryExpression sqlQuery, DbTable table, DbMainTableExpression dependentTable) { ComplexObjectModel newModel = new ComplexObjectModel(this.ConstructorDescriptor); newModel.DependentTable = dependentTable; newModel.IncludeCollections.AddRange(this.IncludeCollections); foreach (var kv in this.PrimitiveConstructorParameters) { ParameterInfo pi = kv.Key; DbExpression exp = kv.Value; DbColumnAccessExpression cae = null; cae = ObjectModelHelper.ParseColumnAccessExpression(sqlQuery, table, exp, pi.Name); newModel.AddConstructorParameter(pi, cae); } foreach (var kv in this.ComplexConstructorParameters) { ParameterInfo pi = kv.Key; IObjectModel val = kv.Value; ComplexObjectModel complexMemberModel = val.ToNewObjectModel(sqlQuery, table, dependentTable) as ComplexObjectModel; newModel.AddConstructorParameter(pi, complexMemberModel); } foreach (var kv in this.PrimitiveMembers) { MemberInfo member = kv.Key; DbExpression exp = kv.Value; DbColumnAccessExpression cae = ObjectModelHelper.ParseColumnAccessExpression(sqlQuery, table, exp, member.Name); newModel.AddPrimitiveMember(member, cae); if (exp == this.PrimaryKey) { newModel.PrimaryKey = cae; if (this.NullChecking == this.PrimaryKey) { newModel.NullChecking = cae; } } } foreach (var kv in this.ComplexMembers) { MemberInfo member = kv.Key; IObjectModel val = kv.Value; ComplexObjectModel complexMemberModel = val.ToNewObjectModel(sqlQuery, table, dependentTable) as ComplexObjectModel; newModel.AddComplexMember(member, complexMemberModel); } if (newModel.NullChecking == null) { newModel.NullChecking = ObjectModelHelper.TryGetOrAddNullChecking(sqlQuery, table, this.NullChecking); } return(newModel); }