public void SaveEventsFor <TAggregate>(Guid?aggregateId, int eventsLoaded, ArrayList newEvents) { var aggregate = this.Aggregates.Find(aggregateId.Value); if (aggregate == null) { aggregate = new CqrsModels.Aggregate { Id = aggregateId.Value, AggregateType = typeof(TAggregate).AssemblyQualifiedName, CommitDateTime = DateTime.UtcNow }; Aggregates.Add(aggregate); } for (int i = 0; i < newEvents.Count; i++) { var e = newEvents[i]; eventsLoaded = eventsLoaded + i; Events.Add(new CqrsModels.Event { Id = Guid.NewGuid(), AggregateId = aggregate.Id, SequenceNumber = eventsLoaded, Type = e.GetType().AssemblyQualifiedName, Body = SerializeEvent(e), CommitDateTime = aggregate.CommitDateTime }); } _context.Commit(); }
/// <summary> /// Initializes a new instance of the <see cref="Select"/> class. /// </summary> /// <param name="aggregates">The aggregates.</param> public Select(params Aggregate[] aggregates) { foreach (Aggregate agg in aggregates) { Aggregates.Add(agg); } }
/// <summary> /// Initializes a new instance of the <see cref="Select"/> class. /// </summary> /// <param name="provider">The provider.</param> /// <param name="aggregates">The aggregates.</param> public Select(IDataProvider provider, params Aggregate[] aggregates) { SQLCommand = SqlFragment.SELECT; _provider = provider; foreach (Aggregate agg in aggregates) { Aggregates.Add(agg); } }
/// <summary> /// Deserializa os dados agregados. /// </summary> /// <param name="aggregate"></param> private void DeserializeAggregate(string aggregate) { Func <AggregateFunction> func; if (_aggregateFactories.TryGetValue(aggregate, out func)) { Aggregates.Add(func()); } }
public CatalogSchema() : base("Catalog", "Telesophy.Alexandria.Model") { Entities.Add(mediaSetEntity); Entities.Add(mediaItemEntity); Entities.Add(artistEntity); Aggregates.Add(mediaSetWithAllChildren); Aggregates.Add(mediaItemSingleton); }
/// <summary> /// Initializes a new instance of the <see cref="Select"/> class. /// </summary> /// <param name="provider">The provider.</param> /// <param name="aggregates">The aggregates.</param> public Select(DataProvider provider, params Aggregate[] aggregates) { Provider = provider; ProviderName = provider.Name; foreach (Aggregate agg in aggregates) { Aggregates.Add(agg); } }
private void DeserializeAggregate(string aggregate) { Func <AggregateFunction> factory; if (aggregateFactories.TryGetValue(aggregate, out factory)) { Aggregates.Add(factory()); } }
/// <summary> /// Initializes a new instance of the <see cref="Select"/> class. /// </summary> /// <param name="aggregates">The aggregates.</param> public Select(params Aggregate[] aggregates) { _provider = ProviderFactory.GetProvider(); SQLCommand = SqlFragment.SELECT; foreach (Aggregate agg in aggregates) { Aggregates.Add(agg); } }
private void EnsureAggregateExists <TAggregate>(Guid AggregateRootId) where TAggregate : IAggregateRoot { var aggregate = Aggregates.Where(x => x.Id == AggregateRootId).FirstOrDefault(); if (aggregate == null) { var aggregateDocument = new AggregateDocument(id: AggregateRootId, type: typeof(TAggregate).AssemblyQualifiedName); Aggregates.Add(aggregateDocument); } }
/// <summary> /// Initializes a new instance of the <see cref="Select"/> class. /// </summary> /// <param name="provider">The provider.</param> /// <param name="aggregates">The aggregates.</param> public Select(IDataProvider provider, params Aggregate[] aggregates) { _provider = provider; this.sqlFragment = _provider.SqlFragment; SQLCommand = this.sqlFragment.SELECT; foreach (Aggregate agg in aggregates) { Aggregates.Add(agg); } }
/// <summary> /// 构造nvl /// </summary> /// <param name="defaultValue"></param> /// <returns></returns> public Property nvl(object defaultValue) { if (defaultValue.GetType().IsValueType) { Aggregates.Add("nvl({0}, " + defaultValue + ")"); } else { Aggregates.Add("nvl({0}, '" + defaultValue + "')"); } return(this); }
public void RaiseAggregate <TAggRequest, TAggResponse>(TAggRequest dto, params string[] queues) where TAggRequest : IApiRequestDto { var request = new ApiControllerRequestDto() { Request = dto, ResponseType = typeof(TAggResponse).FullName, Destination = queues.ToList() }; var eventRequestDto = ApplicationContext.Container.Resolve <IEventRequestDto <ApiControllerRequestDto> >(); eventRequestDto.Queues = queues.ToList(); eventRequestDto.MetaData = request; Events.Add(eventRequestDto); Aggregates.Add(eventRequestDto); }
/// <summary> /// Links the child column with this datagrid. /// </summary> /// <param name="column">Column to link with this datagrid.</param> internal void Hook(DataGridAggregate <TItem> aggregate) { Aggregates.Add(aggregate); }
/// <summary> /// 构造Substr /// </summary> /// <param name="start"></param> /// <param name="length"></param> /// <returns></returns> public Property Substr(int start, int length) { Aggregates.Add("substr({0}, " + start + ", " + length + ")"); return(this); }
/// <summary> /// 构造Mix /// </summary> /// <returns></returns> public Property Mix() { Aggregates.Add("Mix({0})"); return(this); }
/// <summary> /// 构造Count /// </summary> /// <returns></returns> public Property Count() { Aggregates.Add("Count({0})"); return(this); }
/// <summary> /// 构造Sum /// </summary> /// <returns></returns> public Property Sum() { Aggregates.Add("Sum({0})"); return(this); }