public static IEnumerable <dynamic> GetList(this IDbConnection connection, SelectConfiguration selectConfiguration, object parameterValues) { var selectQuery = new QueryBuilder.SelectQueryBuilder.QueryBuilder().GetSelectQuery(selectConfiguration); return(connection.Query <dynamic>(selectQuery, parameterValues)); }
public static IEnumerable <T> GetList <T>(this IDbConnection connection, SelectConfiguration selectConfiguration, object parameterValues) { return(GetList <T>(connection, new QueryBuilder.SelectQueryBuilder.QueryBuilder().GetSelectQuery(selectConfiguration), parameterValues, CommandType.Text)); }
public static T FindById <T>(this IDbConnection connection, SelectConfiguration configuration, object id, Tenant tenant = null) { var selectQuery = new QueryBuilder.SelectQueryBuilder.QueryBuilder().GetSelectQuery(configuration); if (!selectQuery.ToUpper().Contains("WHERE")) { selectQuery = selectQuery + "Where Id=@Id"; } return(FindById <T>(connection, selectQuery, id, tenant: tenant)); }
private void PromptConfigurationSelection() { try { selectConfiguration = new SelectConfiguration(this); Task.Run(async () => await PopupNavigation.Instance.PushAsync(selectConfiguration, true)); } catch (Exception ex) { Debug.Write(ex.StackTrace); } }
public static SelectConfiguration GetSelectConfiguration <T>() { var properties = FilterProperties <T>(typeof(T).GetProperties()); var selectConfiguration = new SelectConfiguration(); var columns = new List <SqlColumn>(); PropertyInfo idProperty = null; properties.ForEach(p => { if (p.Name == "Id") { idProperty = p; } columns.Add(new SqlColumn { AsName = p.Name, Name = p.Name, TableName = typeof(T).Name }); }); var property = properties .FirstOrDefault(p => p.GetCustomAttributes(false) .Any(a => a is KeyAttribute)); selectConfiguration.MainTableName = typeof(T).Name; selectConfiguration.Columns = columns.GetExtensionColumns <T>(selectConfiguration.MainTableName); selectConfiguration.IsPaging = false; if (property == null) { if (idProperty != null) { selectConfiguration.KeyColumnName = idProperty.Name; } } else { selectConfiguration.KeyColumnName = property.Name; } selectConfiguration.Relationships = new List <SqlRelationship>(); selectConfiguration.Relationships.AddRange(GetRelationships <T>(selectConfiguration.MainTableName, selectConfiguration.KeyColumnName)); return(selectConfiguration); }
public static dynamic FindById(this IDbConnection connection, SelectConfiguration selectConfiguration, object id) { var selectQuery = new QueryBuilder.SelectQueryBuilder.QueryBuilder().GetSelectQuery(selectConfiguration); return(FindById(connection, selectQuery, id)); }