Пример #1
0
    public ExtensionDictionaryInfo <T, KVP, K, V> RegisterDictionary <T, KVP, K, V>(
        Expression <Func <T, IEnumerable <KVP> > > collectionSelector,
        Expression <Func <KVP, K> > keySelector,
        Expression <Func <KVP, V> > valueSelector,
        ResetLazy <HashSet <K> >?allKeys = null)
        where T : Entity
        where K : notnull
    {
        var mei = new ExtensionDictionaryInfo <T, KVP, K, V>(collectionSelector, keySelector, valueSelector,
                                                             allKeys ?? GetAllKeysLazy <T, KVP, K>(collectionSelector, keySelector));

        RegisteredExtensionsDictionaries.Add(PropertyRoute.Root(typeof(T)), mei);

        return(mei);
    }
Пример #2
0
    public ExtensionDictionaryInfo <M, KVP, K, V> RegisterDictionaryInEmbedded <T, M, KVP, K, V>(
        Expression <Func <T, M> > embeddedSelector,
        Expression <Func <M, IEnumerable <KVP> > > collectionSelector,
        Expression <Func <KVP, K> > keySelector,
        Expression <Func <KVP, V> > valueSelector,
        ResetLazy <HashSet <K> >?allKeys = null)
        where T : Entity
        where M : ModifiableEntity
        where K : notnull
    {
        var mei = new ExtensionDictionaryInfo <M, KVP, K, V>(collectionSelector, keySelector, valueSelector,
                                                             allKeys ?? GetAllKeysLazy <T, KVP, K>(CombineSelectors(embeddedSelector, collectionSelector), keySelector));

        RegisteredExtensionsDictionaries.Add(PropertyRoute.Construct(embeddedSelector), mei);

        return(mei);
    }