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,
            Expression <Func <T, EmbeddedEntity> > forEmbedded = null,
            ResetLazy <HashSet <K> > allKeys = null)
            where T : Entity
        {
            var mei = new ExtensionDictionaryInfo <T, KVP, K, V>
            {
                CollectionSelector = collectionSelector,
                KeySelector        = keySelector,
                ValueSelector      = valueSelector,

                AllKeys = allKeys ?? GetAllKeysLazy <T, KVP, K>(collectionSelector, keySelector)
            };

            var route = forEmbedded == null?
                        PropertyRoute.Root(typeof(T)) :
                            PropertyRoute.Construct(forEmbedded);

            RegisteredExtensionsDictionaries.Add(route, mei);

            return(mei);
        }
示例#2
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);
        }
示例#3
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);
        }