internal void GroupBy(LambdaExpression expression) { expression.ThrowIfNull(nameof(expression)); var fieldName = TableInfo.GetColumnName(expression.Body.GetMemberExpression()); var memberNode = new MemberNode { TableName = TableName, FieldName = fieldName }; Context.GroupBy.Add(SqlFormatter.Field(memberNode)); }
internal void OrderByPrimaryKey() { var memberNode = new MemberNode { TableName = TableName, FieldName = EntityIdName }; var formattedField = SqlFormatter.Field(memberNode); if (!Context.OrderBy.Contains(formattedField)) { Context.OrderBy.Add(formattedField); } }
internal void OrderBy(LambdaExpression expression) { expression.ThrowIfNull(nameof(expression)); var fieldName = TableInfo.GetColumnName(expression.Body.GetMemberExpression()); var memberNode = new MemberNode { TableName = TableName, FieldName = fieldName }; var formattedField = SqlFormatter.Field(memberNode); if (!Context.OrderBy.Contains(formattedField)) { Context.OrderBy.Add(formattedField); } }
private void Select(MemberExpression expression) { if (expression.Type.IsClass && (expression.Type != typeof(string))) { Select(TableInfo.GetTableName(expression.Type)); } else { var node = new MemberNode { TableName = TableName, FieldName = TableInfo.GetColumnName(expression) }; Context.Selection.Add(SqlFormatter.Field(node)); } }