Skip to content

How do I get the document from using ISession? #16435

Closed Answered by weirdyang
weirdyang asked this question in Q&A
Discussion options

You must be logged in to vote

Declare a property id with type long on your model, this will be autopopulated with the document id

    public class TestEntity: Entity
    {
        public long Id { get; set; }

        public const string Collection = "TestObject";

        public string ObjectId { get; set; }  = Guid.NewGuid().ToString();

        public string Name { get; set; } = Path.GetRandomFileName();
    }

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@weirdyang
Comment options

Comment options

You must be logged in to vote
1 reply
@hishamco
Comment options

Answer selected by weirdyang
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants