Skip to content

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

@meatcorps

Description

@meatcorps

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions