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

  • Home
  • SEARCH
  • 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 7040531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:55:46+00:00 2026-05-28T01:55:46+00:00

I current have an object that has a public property called Id. When I

  • 0

I current have an object that has a public property called Id. When I store the object, I would like the Id to be part of the Data and not become the document Id like it currently does. When creating the document store I only set the connection string.

using (var session = documentStore.OpenSession())
{
    session.Store(a);
    session.SaveChanges();
}


a can be thought of an object as:
public class A
{
    public Guid Id { get; set; }
    //other properties
}

So either I want it to generate a random Id or have both the data and the documentId being the Id property of class A.

EDIT:

So two possibilities:
1. Document Id = Id and the

Data Section contains:
{
    data //sorry if the notation is not correct, doing it off of memory
    {
        Id: [my guid] 
        //other properities
    }
}

Or the data containing the Id and Document ID = randomly generated by raven

  • 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-05-28T01:55:46+00:00Added an answer on May 28, 2026 at 1:55 am

    You can use this if you want Id to be a property that you control on your own and have raven use another property as the documents id instead:

    public class User
    {
        public string DocumentId { get; set; }
        public Guid Id { get; set; }
        public string Name { get; set; }
    
        public User()
        {
            Id = Guid.NewGuid();
        }
    }
    
    documentStore.Conventions.FindIdentityProperty = prop =>
    {
        if (prop.DeclaringType == typeof(User))
            return prop.Name == "DocumentId";
    
        return prop.Name == "Id";
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a class module in an Excel project that has a property called
I have the current basic structure for each domain object that I need to
Lets say that you have a business object whose current state implies that there
I have a code sample that gets a SEL from the current object, SEL
i have a class that extends another. when i iterate the current object i
I have an object that has a list of 'observers'. These observers get notified
For simplicity have a modelview (MyModelView) that contains a Scheduler property which has a
I have a UserControl that has some javascript I'd like to inject into a
My current setup : I have an entity object with some properties, among them
My problem is this, I have a UC called profile that contains another UC

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.