Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8469569
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T16:15:54+00:00 2026-06-10T16:15:54+00:00

If I have an object with nothing but private properties such as public class

  • 0

If I have an object with nothing but private properties such as

public class Foo
{
    private int Id { get; set; }
    private string Bar { get; set; }
    private string Baz { get; set; }
}

and store it in Raven, it will store those properties and everything works like magic. If I want to do some sort of read-only query off of the collection, how would I go about doing so using an index? (I’m actually open to any solution, even if it doesn’t use indices.)

Obviously, something like this will not work because of the private access (and dynamic cannot be used in an expression tree):

public class Foo_LineItems : AbstractIndexCreationTask<Foo, FooLineItem>
{
    public Foo_LineItems ()
    {
        Map = foos => foos.Where (x => x.Baz == null)
                          .Select (x => new { x.Id, x.Bar });
    }
}

I’m sure I have overlooked something, but have been searching the web and cannot find anything that answers this specific question. The obvious answer is to segregate the reads and writes, using CQRS, and not actually persist the raw domain object. (This is just an experiment with Raven and CQS.)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T16:15:56+00:00Added an answer on June 10, 2026 at 4:15 pm

    We have untyped API for doing this:

    public class Foo_LineItems : AbstractIndexCreationTask
    {
        public override IndexDefinition CreateIndexDefinition()
        {
            return new IndexDefinition
            {
                Map = @"
                        from foo in docs.Foos
                        where foo.Baz == null
                        select new { foo.Id, foo.Bar }
    "
            };
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Public Class frmMain Private p_dlgAdd As frmAdd = Nothing Public ReadOnly Property _dlgAdd As
I have a Task class wich has a string text private member. I access
I have an object Document with nested Properties (Name, Value) collection. Now I want
I have a method which instantiates an object, some of the properties of this
Assume we have following JPA Entities: class Parent { @Id private Long id; }
So I have sent close to two hours searching for an answer but nothing
I am searching for an example of using imagemagick.net, but nothing found. I have
I have Pojo object, with getAsJson function to return Json string for this object.
I have tried the following: private void Form1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) { if ((Keys)
I have controls which are not updating their bound object's respective properties until focus

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.