public static string GetSelectFields(System.Type type, ISqlBuilder builder, params string[] ignorProperties)
        {
            ORMappingItemCollection mapping = InnerGetMappingInfo(type);

            SelectSqlClauseBuilder selectBuilder = GetSelectSqlClauseBuilder(false, mapping, ignorProperties);

            return(selectBuilder.ToSqlString(TSqlBuilder.Instance));
        }
        private static string GetSelectSql(bool useTableName, ORMappingItemCollection mapping, ISqlBuilder builder, string[] ignorProperties)
        {
            ExceptionHelper.FalseThrow <ArgumentNullException>(mapping != null, "mapping");
            ExceptionHelper.FalseThrow <ArgumentNullException>(builder != null, "builder");

            SelectSqlClauseBuilder selectBuilder = GetSelectSqlClauseBuilder(useTableName, mapping, ignorProperties);

            return(string.Format("SELECT {0} FROM {1} ", selectBuilder.ToSqlString(builder), mapping.TableName));
        }
        private static SelectSqlClauseBuilder GetSelectSqlClauseBuilder(bool useTableName, ORMappingItemCollection mapping, params string[] ignorProperties)
        {
            ExceptionHelper.FalseThrow <ArgumentNullException>(mapping != null, "mapping");

            SelectSqlClauseBuilder builder = new SelectSqlClauseBuilder();

            if (useTableName)
            {
                builder.TableName = mapping.TableName;
            }
            FillSqlClauseBuilder(builder, mapping, ClauseBindingFlags.Select,
                                 new DoSelectClauseBuilder(DoSelectSqlClauseBuilder), ignorProperties);

            return(builder);
        }
 private static void FillSqlClauseBuilder(SelectSqlClauseBuilder builder, ORMappingItemCollection mapping,
                                          ClauseBindingFlags bindingFlags, DoSelectClauseBuilder builderDelegate, params string[] ignorProperties)
 {
     foreach (ORMappingItem item in mapping)
     {
         if (Array.Exists <string>(ignorProperties,
                                   delegate(string target)
         {
             return(string.Compare(target, item.PropertyName, true) == 0);
         }) == false)
         {
             if ((item.BindingFlags & bindingFlags) != ClauseBindingFlags.None)
             {
                 builderDelegate(builder, item);
             }
         }
     }
 }
 private static void DoSelectSqlClauseBuilder(SelectSqlClauseBuilder builder, ORMappingItem item)
 {
     builder.AppendItem(item.DataFieldName);
 }