Cysharp / Cysharp/MasterMemory

Make it possible to cross reference between tables and make table extensions. Regarding relations

Open
#115 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
1.8k
Forks
123
PR merge metrics
No merged PRs in 30d

Description

I have been playing around with this package. But I really miss the feature in the table extensions that is not referencing the database it self:

partial void OnAfterConstruct()
{
}

Yes you can make very handy table extensions here. But in my use case I really like to add extension method. For example. Person has items. Persons and items are a many to many relation.

By only referencing the database as well this make it possible:

public sealed partial class PersonRelationTable
{
private MemoryDatabase _database;

    partial void OnAfterConstruct(MemoryDatabaseBase db)
    {
        _database = (MemoryDatabase)db;
    }

    public IEnumerable<RelationItem> GetItemsFromPerson(int personId)
    {
        foreach (var item in _database.PersonRelationItemTable.FindByPersonId(personId))
        {
            yield return _database.RelationItemTable.FindByItemId(item.ItemId);
        }
    }
}

Btw I already made the change. So if you are interested in my changes let me know. Also thank you for the amazing work!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting the table-extension generation around OnAfterConstruct and MemoryDatabaseBase. Use the PersonRelationTable example to trace how generated tables receive database access; done means an extension can retain the database reference and cross-reference related tables without breaking existing extensions.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.