static MercuryApiController() { _viewModel = new AggregateModel() { ResponseModels = new List <ResponseModel>() }; }
public void BuildEventInterfaceMethodsWithContext(AggregateModel context) { this.PushIndent("\t\t"); foreach (DomainEvent evt in context.AggregateRoot.DomainEvents) { this.WriteLine("void Apply(" + evt.Name + " e, MessageContext context);"); } this.PopIndent(); }
public string GetAggregateRootDescription(AggregateModel context) { if (context != null && context.AggregateRoot != null) { return(context.AggregateRoot.Description); } else { return("Aggregate Root description cannot be obtained. Make sure your model contains an aggregate root with a description"); } }
public string GetAggregateRootName(AggregateModel context) { if (context != null && context.AggregateRoot != null) { return(context.AggregateRoot.Name); } else { return("Aggregate Root name cannot be obtained. Make sure your model contains an aggregate root with a name"); } }
public DispatcherTests() { Events = Substitute.For <IEventStore>(); Services = Substitute.For <IServiceProvider>(); Services.GetService(typeof(Domains.Airline.FlightReservation)).Returns(new Domains.Airline.FlightReservation()); var resv = new AggregateModel(typeof(Domains.Airline.FlightReservation)); resv.SetFactoryHandler("Create"); resv.AddCommandHandler("Cancel"); Dispatcher = new Dispatcher(new BoundedContextModel(new[] { resv }), Events, Services); }
public void BuildCommandInterfaceMethodsWithContext(AggregateModel context) { this.PushIndent("\t\t"); foreach (DomainCommand command in context.AggregateRoot.DomainCommands) { if (!string.IsNullOrEmpty(command.RequiredPrivilege)) { this.WriteLine("[RequiresPrivilege(\"" + command.RequiredPrivilege + "\")]"); } this.WriteLine("void Handle(" + command.Name + " c, MessageContext context);"); } this.PopIndent(); }
public async Task <IActionResult> OnGetAsync(Guid id) { Product = await _dispatcher.GetResultAsync(new GetProduct { ProductId = id }); AggregateModel = await _dispatcher.GetResultAsync(new GetAggregateModel { AggregateRootId = id }); return(Page()); }
public IActionResult Post(AggregateModel model) { var queryView = _queryViewFinder.FindById(model.QueryViewId); if (queryView == null) { return(NotFound()); } if (queryView != null && queryView.AggregateConfig.IsNotEmpty()) { var aggFields = new List <AggregateExpressionField>().DeserializeFromJson(queryView.AggregateConfig); if (aggFields.NotEmpty()) { var queryExp = new QueryExpression().DeserializeFromJson(queryView.FetchConfig); if (model.Filter != null && (model.Filter.Conditions.NotEmpty() || (model.Filter.Filters.NotEmpty() && model.Filter.Filters.First().Conditions.NotEmpty()))) { queryExp.Criteria.AddFilter(model.Filter); } var aggExp = new AggregateExpression { ColumnSet = queryExp.ColumnSet, Criteria = queryExp.Criteria, EntityName = queryExp.EntityName, LinkEntities = queryExp.LinkEntities, AggregateFields = aggFields }; var aggDatas = _aggregateService.Execute(aggExp); var attributes = _attributeFinder.FindByName(queryView.EntityId, aggFields.Select(x => x.AttributeName).ToArray()); foreach (dynamic item in aggDatas) { var line = item as IDictionary <string, object>; var attribute = attributes.Find(x => x.Name.IsCaseInsensitiveEqual(line.Keys.First())); item.metadata = new { attribute.Name, attribute.LocalizedName, attribute.AttributeTypeName, attribute.EntityId, attribute.EntityName, attribute.EntityLocalizedName }; item.aggregatetype = aggFields.Find(x => x.AttributeName.IsCaseInsensitiveEqual(attribute.Name)).AggregateType; } return(JOk(new { View = new { queryView.QueryViewId, queryView.Name }, Data = aggDatas })); } } return(JOk()); }
public string GetCommandInterfaceExtenders(AggregateModel context) { //this.PushIndent("\t\t"); StringBuilder sb = new StringBuilder(); int count = 0; foreach (DomainCommand cmd in context.AggregateRoot.DomainCommands) { if (count == 0) { sb.AppendFormat("\n\t\tIHandleCommand<{0}>\n", cmd.Name); } else { sb.AppendFormat(",\n\t\tIHandleCommand<{0}>\n", cmd.Name); } count++; } //this.PopIndent(); return(sb.ToString()); }
public string GetEventInterfaceExtenders(AggregateModel context) { //IApplyEvent<PlayerCreated> //this.PushIndent("\t\t"); StringBuilder sb = new StringBuilder(); int count = 0; foreach (DomainEvent evt in context.AggregateRoot.DomainEvents) { if (count == 0) { sb.AppendFormat("\n\t\tIApplyEvent<{0}>\n", evt.Name); } else { sb.AppendFormat(",\n\t\tIApplyEvent<{0}>\n", evt.Name); } count++; } //this.PopIndent(); return(sb.ToString()); }
public override object EditValue( ITypeDescriptorContext context, IServiceProvider provider, object value) { if ((context == null) || (provider == null) || (context.PropertyDescriptor == null)) { return(base.EditValue(context, provider, value)); } _wfes = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); ListBox listBox = new ListBox(); listBox.Sorted = true; listBox.Click += new EventHandler(List_Click); listBox.Items.Add("String"); listBox.Items.Add("Boolean"); listBox.Items.Add("Currency"); listBox.Items.Add("DateTime"); listBox.Items.Add("Decimal"); listBox.Items.Add("Double"); listBox.Items.Add("Int32"); listBox.Items.Add("Single"); listBox.Items.Add("Int62"); listBox.Items.Add("Guid"); listBox.Items.Add("Object"); listBox.Items.Add("TimeSpan"); ElementPropertyDescriptor desc = context.PropertyDescriptor as ElementPropertyDescriptor; Property currentElement = desc.ModelElement as Property; AggregateModel currentModel = currentElement.AggregateModel; listBox.SelectedItem = value; _wfes.DropDownControl(listBox); return(listBox.SelectedItem); }
public void TestGenerate() { var code = @"using Atomiv.Core.Domain; namespace Generator.Core.Domain.MyCats { public class MyCatIdentity : Identity<int> { public static readonly MyCatIdentity Null = new MyCatIdentity(0); public MyCatIdentity(int id) : base(id) { } } }"; var model = new AggregateModel("MyCat", "MyCats"); var identityGenerator = new IdentityGenerator(model); var identitySourceCode = identityGenerator.Generate(); Assert.Equal(code, identitySourceCode); }
public AggregateModelTests() { Model = new AggregateModel(typeof(Domains.Airline.FlightReservation)); Model.SetFactoryHandler(new CommandHandlerModel(Model.Type.GetMethods().Single(c => c.Name == "Create"))); Model.AddCommandHandler(new CommandHandlerModel(Model.Type.GetMethods().Single(c => c.Name == "Cancel"))); }
public IdentityGenerator(AggregateModel model) : base(model) { }
public AggregateModelBuilder() { _model = new AggregateModel(typeof(T)); }
public BoundedContextModelTests() { var aggregate = new AggregateModel(typeof(Domains.Airline.FlightReservation)); Model = new BoundedContextModel(new [] { aggregate }); }
public Generator(AggregateModel model) { Model = model; }