コード例 #1
0
        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));
        }
コード例 #2
0
 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));
 }
コード例 #3
0
        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));
        }
コード例 #4
0
ファイル: Init.xaml.cs プロジェクト: lulzzz/DCAnalytics
 private void PromptConfigurationSelection()
 {
     try
     {
         selectConfiguration = new SelectConfiguration(this);
         Task.Run(async () => await PopupNavigation.Instance.PushAsync(selectConfiguration, true));
     }
     catch (Exception ex)
     {
         Debug.Write(ex.StackTrace);
     }
 }
コード例 #5
0
        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);
        }
コード例 #6
0
        public static dynamic FindById(this IDbConnection connection, SelectConfiguration selectConfiguration, object id)
        {
            var selectQuery = new QueryBuilder.SelectQueryBuilder.QueryBuilder().GetSelectQuery(selectConfiguration);

            return(FindById(connection, selectQuery, id));
        }