public static IServiceCollection AddDasyncForAspNetCore( this IServiceCollection services, ICommunicationModel model = null, bool?isDevelopment = null) { services.AddModules( Dasync.Serialization.DI.Bindings, Dasync.Serialization.DasyncJson.DI.Bindings, Dasync.Serialization.Json.DI.Bindings, Dasync.Serializers.StandardTypes.DI.Bindings, Dasync.Serializers.EETypes.DI.Bindings, Dasync.Serializers.DomainTypes.DI.Bindings, Dasync.Proxy.DI.Bindings, Dasync.AsyncStateMachine.DI.Bindings, Dasync.ExecutionEngine.DI.Bindings, Dasync.Communication.Http.DI.Bindings, Dasync.Hosting.AspNetCore.DI.Bindings); if (isDevelopment == true || (!isDevelopment.HasValue && AspNetCoreEnvironment.IsDevelopment)) { services.AddModules(Dasync.Hosting.AspNetCore.Development.DI.Bindings); } if (model != null) { services.AddCommunicationModel(model); services.AddDomainServicesViaDasync(model); } return(services); }
public StartupHostedService( ICommunicationModel communicationModel, IDomainServiceProvider domainServiceProvider, ICommunicationListener communicationListener) { _communicationModel = communicationModel; _domainServiceProvider = domainServiceProvider; _communicationListener = communicationListener; }
public static IApplicationBuilder UseDasync(this IApplicationBuilder app, ICommunicationModel model) { app.ApplicationServices.GetService <CommunicationModelProvider.Holder>().Model = model; app.UseMiddleware <ScopedServiceProviderMiddleware>(); app.UseMiddleware <DasyncMiddleware>(); return(app); }
public DomainTypesSerializerSelector( ICommunicationModel communicationModel, EntityProjectionSerializer entityProjectionSerializer) { _knownEntityProjectionInterfaces = new HashSet <Type>( communicationModel.EntityProjections .Select(d => d.InterfaceType) .Where(i => EntityProjection.IsProjectionInterface(i))); _entityProjectionSerializer = entityProjectionSerializer; _entityProjectionSerializer.KnownEntityProjectionInterfaces = _knownEntityProjectionInterfaces; }
public ServiceProxyBuilder( ICommunicationModel communicationModel, IProxyTypeBuilder proxyTypeBuilder, IProxyMethodExecutor proxyMethodExecutor, IDomainServiceProvider domainServiceProvider, ISerializedServiceProxyBuilder holder) { ((SerializedServiceProxyBuilderHolder)holder).Builder = this; _communicationModel = communicationModel; _proxyTypeBuilder = proxyTypeBuilder; _proxyMethodExecutor = proxyMethodExecutor; _domainServiceProvider = domainServiceProvider; }
public CommunicationListener( ICommunicationModel communicationModel, ICommunicationModelConfiguration communicationModelConfiguration, IEventSubscriber eventSubscriber, IEventIdProvider eventIdProvider, IServiceResolver serviceResolver, IEnumerable <IMessageListeningMethod> listeningMethods) { _communicationModel = communicationModel; _communicationModelConfiguration = communicationModelConfiguration; _eventSubscriber = eventSubscriber; _eventIdProvider = eventIdProvider; _serviceResolver = serviceResolver; _listeningMethods = listeningMethods.ToDictionary(m => m.Type, m => m, StringComparer.OrdinalIgnoreCase); }
public static IServiceCollection AddDasyncInMemoryEmulation( this IServiceCollection services, ICommunicationModel model = null) { services.AddModules( Dasync.Serialization.DI.Bindings, Dasync.Serialization.DasyncJson.DI.Bindings, Dasync.Serializers.StandardTypes.DI.Bindings, Dasync.Serializers.EETypes.DI.Bindings, Dasync.Serializers.DomainTypes.DI.Bindings, Dasync.Proxy.DI.Bindings, Dasync.AsyncStateMachine.DI.Bindings, Dasync.ExecutionEngine.DI.Bindings, Dasync.Communication.InMemory.DI.Bindings, Dasync.Persistence.InMemory.DI.Bindings); if (model != null) { services.AddCommunicationModel(model); services.AddDomainServicesViaDasync(model); } return(services); }
public ServiceResolver(ICommunicationModel communicationModel, IDomainServiceProvider domainServiceProvider) { _communicationModel = communicationModel; _domainServiceProvider = domainServiceProvider; }
public static IServiceCollection AddDomainServicesViaDasync(this IServiceCollection services, ICommunicationModel model) { foreach (var serviceDefinition in model.Services) { if (serviceDefinition.Implementation != null) { services.Add(new ServiceDescriptor( serviceDefinition.Implementation, serviceProvider => serviceProvider .GetService <IServiceProxyBuilder>() .Build(new ServiceId { ServiceName = serviceDefinition.Name }), ServiceLifetime.Singleton)); } if (serviceDefinition.Interfaces != null) { foreach (var interfaceType in serviceDefinition.Interfaces) { services.Add(new ServiceDescriptor( interfaceType, serviceProvider => serviceDefinition.Implementation != null ? serviceProvider.GetService(serviceDefinition.Implementation) : serviceProvider .GetService <IServiceProxyBuilder>() .Build(new ServiceId { ServiceName = serviceDefinition.Name }), ServiceLifetime.Singleton)); } } } return(services); }
public EntityProjectionConverter(ICommunicationModel model) { _knownProjectionInterfaces = new HashSet <Type>(model.EntityProjections.Select(p => p.InterfaceType)); }
public static IServiceCollection AddCommunicationModel(this IServiceCollection services, ICommunicationModel model) { services.AddSingleton(model); return(services); }
public UnknownExternalServiceDefinition(string name, ICommunicationModel model) { Name = name; Model = model; }