コード例 #1
0
        public IFieldReader <TItem> Get(Stem <TItem> stem)
        {
            var substemCreator = new SubstemEngineSubContextCreator <TItem, TNav, TSubstem>(stem);
            StemsEngineSubContext <TNav> subContext = substemCreator.GetEngineContext();

            return(new SubCollectionFieldReader <TItem, TCollection, TNav>(_navigationExpression, subContext));
        }
コード例 #2
0
        public SubCollectionFieldWriterTests()
        {
            var subStem = new ArtistAlbumsStem();

            subStem.SetParent(new TestStartAxis());

            StemsEngineSubContext <Album> stemsEngineSubContext = new StemsEngineSubContext <Album>(subStem);
            var tools = new SubWriterTools <Artist, IEnumerable <Album>, Album>(a => a.Albums, null, null);

            NameFieldWriter = new SubCollectionFieldWriter <Artist, IEnumerable <Album>, Album>(tools, stemsEngineSubContext);
        }
コード例 #3
0
        public IFieldWriter <TItem> Get(Stem <TItem> stem)
        {
            var substemCreator = new SubstemEngineSubContextCreator <TItem, TNav, TSubstem>(stem);
            StemDataChangeEvents <TNav>  stemEvents = substemCreator.GetDataChangeEvents();
            StemsEngineSubContext <TNav> subContext = substemCreator.GetEngineContext();

            MethodSetter <TItem, TNav> setter = MethodSetter <TItem, TNav> .FromDefinition(_definition, stem);

            var tools = new SubWriterTools <TItem, TNav, TNav>(_navigationExpression, stemEvents, setter);

            return(new SubItemFieldWriter <TItem, TNav>(tools, subContext));
        }
コード例 #4
0
        public IRestCollection GetRestCollection(Stem <TItem> stem)
        {
            IDataTransaction transaction = _dataSource.CreateTransaction();

            stem.OnDispose += delegate { transaction.Dispose(); };

            IEngineRepository <TItem> repository = _dataSource.GetRepository <TItem>(transaction);

            var wrapper = new DataEventWrapper <TItem>(transaction, repository);

            wrapper.TryWrapEvents(new StemDataChangeEvents <TItem>(stem));

            var subContext = new StemsEngineSubContext <TItem>(stem);
            var context    = new FullEngineContext <TItem>(wrapper.Transaction, wrapper.Repository, subContext);

            return(new EngineRestCollection <TItem>(context));
        }