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)); }
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); }
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)); }
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)); }