Skip to content
This repository was archived by the owner on Aug 18, 2021. It is now read-only.
This repository was archived by the owner on Aug 18, 2021. It is now read-only.

Repository doesn't allow domain types to have inheritance #221

Open
@bruno-brant

Description

@bruno-brant

Let's say you have a domain with two types of Workers: Contractor and Employee. It's the role of a Repository to map between domain objects and the data model, so we'd like to have our repository enabling us to retrieve a Contractor or an Employee from the database.

A data model that would support this domain in a document database (the only kind currently supported by Liquid) would be to have a single collection named Workers that would contain both type of workers. Now, let alone the fact that since Repository isn't customizable we wouldn't be able to have it return either class given a rule. This is bad, but let's say we have our users always inform us whether we are operating on Contractors or Employees; that would overcome the main mapping limitation but we could correctly inform Repository which objects we are looking for.

That wouldn't work, because Liquid uses the class name to determine which collection we are using. So when we say Repository.Get<Contractor>(...) Liquid is looking at "Contractor" collection, while when we say Repository.Get<Employee>(...), Liquid is looking "Employee" collection.

This hard limit imposes a lot on the data structure of our application - for instance, we would need to have two collections.

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussionDiscussion over a feature that might evolve into a bug or feature request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions