Exemplo n.º 1
0
        public SelectQueryFluentBuilder <TModel, TModel> SelectOnly(params Expression <Func <TModel, object> >[] fieldsList)
        {
            var builder = new FieldListBuilder <TModel>();

            foreach (var expression in fieldsList)
            {
                builder.AddField(expression);
            }
            return(SelectOnly(builder));
        }
Exemplo n.º 2
0
        public void SelectColumnsFieldList()
        {
            var fieldsBuilder = new FieldListBuilder <MyModel>();

            fieldsBuilder.AddField(x => x.Id)
            .AddField(x => x.Name)        // duplicated on purpose
            .AddField(x => x.Name);

            var q = Builders <MyModel> .SelectOnly(fieldsBuilder);

            Utils.AssertRawQuery(q, @"SELECT ""id"",""name"" FROM model");
        }