protected override string ParseReferenceFilterValue(ReferenceFilterValue rfv) { var ps = rfv.Path.Split('.'); if (2 != ps.Length) { throw new WrongSchemaDefinitionException("Only one level navigation allowed in join expression. " + rfv.Path); } var path = ps.Take(ps.Length - 1); var name = ps.Last(); if ("source" == path.First().ToLowerInvariant()) { var field = sourceNode.Entity.entityFields.FirstOrDefault(ef => ef.CodeName.ToLowerInvariant() == name.ToLowerInvariant()); return($"{sourceNode.Alias}.{field.DBName}"); } else if ("target" == path.First().ToLowerInvariant()) { var field = targetNode.Entity.entityFields.FirstOrDefault(ef => ef.CodeName.ToLowerInvariant() == name.ToLowerInvariant()); return($"{targetNode.Alias}.{field.DBName}"); } else { throw new WrongSchemaDefinitionException("Error on path definition in join expression. All path should start with 'source' or 'target' instead of " + rfv.Path); } }
protected virtual string ParseReferenceFilterValue(ReferenceFilterValue rfv) { var ps = rfv.Path.Split('.'); var path = ps.Take(ps.Length - 1); var name = ps.Last(); var fn = fromTree.Resolve(path); var field = fn.Entity.entityFields.FirstOrDefault(ef => ef.CodeName.ToLowerInvariant() == name.ToLowerInvariant()); var alias = String.IsNullOrEmpty(fn.Alias) ? "" : fn.Alias + "."; return($"{alias}{field.DBName}"); }
protected string ParseReferenceStringRight(MonoFilter f) { ReferenceFilterValue rfv = (ReferenceFilterValue)f.Right; return(ParseReferenceFilterValue(rfv)); }