question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Inheritance/Relationships

See original GitHub issue

I can’t seem to get my sub-document to save under it’s parent.

var settings = new AlertSettings();
settings.Recipients.Add(new EmailRecipient());

using (var db = new LiteEngine(_dbPath))
{
    Collection<AlertSettings> col = db.GetCollection<AlertSettings>("alertSettings");
    col.EnsureIndex(t => t.Id);
    col.Insert(settings);

    Assert.That(col.FindOne(t => t.Id == settings.Id).Recipients.Count, Is.EqualTo(1)); //Assert fails
}

Am I doing something wrong?

Is it possible to load a many-to-many relationship? The appropriate keys are in the data store, I just need to be able to load them into the appropriate object.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:14 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
mbdavidcommented, Feb 10, 2015

Here is the problem:

public Guid Id { get; private set; }
public List<Pet> Pets { get; private set; }

Properties can’t be private set - fastBinaryJson can’t deserialize private properties. Try use only { get; set; }

0reactions
gregbtycommented, Feb 10, 2015

Thanks now it works fine!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Inheritance (IS-A) vs. Composition (HAS-A) Relationship
In object-oriented programming, the concept of IS-A is a totally based on Inheritance, which can be of two types Class Inheritance or Interface ......
Read more >
Inheritance (object-oriented programming)
The relationships of objects or classes through inheritance give rise to a directed acyclic graph. An inherited class is called a subclass of...
Read more >
Introduction to the Inheritance Relationship: Python OOP ...
It is the relationship that allows you to define a class that inherits all the methods and attributes from other classes. The following...
Read more >
10.2. Inheritance
UML class diagrams denote an inheritance relationship between two classes with an arrow with a outlined, three-sided head. Each class plays a specific...
Read more >
Java inheritance vs. composition: How to choose
Inheritance and composition are two programming techniques developers use to establish relationships between classes and objects.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found