public IPagedGraphCollection <TAggregate> ExecuteWithPaging(IGraphSession session, IQuery <TAggregate> query, bool enlist) { var dataset = Execute(query); if (!dataset.Any()) { return(new PagedGraphGraphCollection <TAggregate>()); } var total = dataset.First().Total; var page = total == 0 ? 1 : query.Skip / total + 1; var results = Map(item => { var aggregate = item.Create(); if (session.Uow.Contains(aggregate)) { aggregate = session.Uow.Get <TAggregate>(ProxyUtils.GetEntityId(aggregate)); } else if (enlist) { aggregate = session.ProxyFactory.Create(aggregate, session); } return(aggregate); }, dataset); return(new PagedGraphGraphCollection <TAggregate>(session, this, query, results, (int)total, (int)page, enlist)); }
protected AbstractRepository(IMapper <T> mapper, IGraphSession session, IProxyFactory proxyFactory) { _mapper = mapper; _session = session; _proxyFactory = proxyFactory; _entityStateCache = session.State; }
public T Create <T>(T item, IGraphSession session, EntityStatus status = EntityStatus.Clean) where T : class { using (Timer.Start("Proxy Creation", _logger)) { var generator = new Generator(session, _metadataFactory, _generator, _options, status); return(generator.Create(item)); } }
public IQueryExecutor <TResult> Create <TResult>(IQuery <TResult> query, IGraphSession session) { if (!_queries.ContainsKey(query.GetType())) { throw new InvalidOperationException("Query executor has not been registered with the query executor factory"); } return((IQueryExecutor <TResult>)_queries[query.GetType()](session)); }
public PagedGraphGraphCollection(IGraphSession session, IQueryExecutor <T> executor, IQuery <T> query, IEnumerable <T> data, int total, int page, bool enlist) { _session = session; _executor = executor; _query = query; Data = data; Total = total; Page = page; }
public IRepository Create(IGraphSession session, Type type) { if (!_mappers.ContainsKey(type)) { throw new InvalidOperationException($"A mapper for type {type} has not been supplied"); } var generic = typeof(GenericAbstractRepository <>).MakeGenericType(type); return((IRepository)Activator.CreateInstance(generic, _mappers[type](session), session, _proxyFactory)); }
public Generator(IGraphSession session, IMetadataFactory metadataFactory, ProxyGenerator generator, ProxyGenerationOptions options, EntityStatus status = EntityStatus.Clean) { _generator = generator; _session = session; _metadataFactory = metadataFactory; _state = session.State; _status = status; _dependencyStack = new Stack <EntityReference>(); _options = options; }
public ICypherTransaction Create(IGraphSession session) { if (_transactions.ContainsKey(session)) { return(_transactions[session]); } var transaction = new CypherTransaction(_db, _logger); _transactions.Add(session, transaction); session.Flushed += OnFlushed; session.Disposed += OnDisposed; return(transaction); }
public IEnumerable <TAggregate> Execute(IGraphSession session, IQuery <TAggregate> query) { var dataset = Execute(query); var results = Map(item => { var aggregate = item.Create(); if (session.Uow.Contains(aggregate)) { aggregate = session.Uow.Get <TAggregate>(ProxyUtils.GetEntityId(aggregate)); } return(aggregate); }, dataset); return(results); }
public Mapper(IGraphSession session, IMetadataFactory metadataFactory) { _session = session; MetadataFactory = metadataFactory; }
public void Inject(IGraphSession session) { _session.Ready(session); }
public void Delete(object item, IGraphSession session) { Delete((T)item, session); }
protected Mapper(IGraphSession session, ICypherTransactionFactory transactionFactory, IMetadataFactory metadataFactory) { _session = session; _transactionFactory = transactionFactory; MetadataFactory = metadataFactory; }
protected abstract void OnDeleted(T item, IGraphSession session);
public void Create(object item, IGraphSession session) { Create((T)item, session); }
public void Update(T item, IGraphSession session) { OnUpdated(item, session); }
protected abstract void OnCreated(T item, IGraphSession session);
public GenericAbstractRepository(IMapper <T> mapper, IGraphSession session, IProxyFactory proxyFactory) : base(mapper, session, proxyFactory) { }
public IRepository <T> Create <T>(IGraphSession session) { return(Create(session, typeof(T)) as IRepository <T>); }
public void Update(object item, IGraphSession session) { Update((T)item, session); }
public void Delete(T item, IGraphSession session) { OnDeleted(item, session); }
public IQueryExecutor <TResult> Create <TResult>(IQuery <TResult> query, IGraphSession session) { throw new NotImplementedException(); }
public GraphSessionFlushedEventArgs(IGraphSession session) { Session = session; }
public GraphSessionDisposedEventArgs(IGraphSession session) { Session = session; }
public PersonMapper(IGraphSession session, ICypherTransactionFactory transactionFactory, IMetadataFactory metadataFactory) : base(session, transactionFactory, metadataFactory) { }
public void Create(T item, IGraphSession session) { OnCreated(item, session); }