public static IShriekBuilder AddSocketServer(this IShriekBuilder builder, Action <WebApiProxyOptions> optionAction) { AppDomain.CurrentDomain.UpdateExcutingAssemblies(); builder.Services.AddSocketServer(optionAction); return(builder); }
public static IShriekBuilder AddEFCoreEventStorage(this IShriekBuilder builder, Action <DbContextOptionsBuilder> optionsAction = null) { builder.Services.AddDbContext <EventStorageSQLContext>(optionsAction); builder.Services.AddScoped <IEventStorageRepository, EventStorageSQLRepository>(); builder.Services.AddScoped <IMementoRepository, EventStorageSQLRepository>(); builder.Services.AddScoped <IEventStorage, SqlEventStorage>(); return(builder); }
public static IShriekBuilder AddLiteDbEventStorage(this IShriekBuilder builder, Action <LiteDBOptions> optionAction) { var options = new LiteDBOptions(); optionAction(options); builder.Services.AddScoped(x => options); builder.Services.AddScoped <EventStorageLiteDatabase>(); builder.Services.AddScoped <IEventStorageRepository, EventStorageRepository>(); builder.Services.AddScoped <IMementoRepository, EventStorageRepository>(); builder.Services.AddScoped <IEventStorage, SqlEventStorage>(); return(builder); }
public static IShriekBuilder AddMongoDBEventStorage(this IShriekBuilder builder, Action <MongoDBOptions> optionsAction) { var options = new MongoDBOptions(); optionsAction(options); builder.Services.AddScoped(x => new MongoDatabase(options)); builder.Services.AddScoped <IEventStorageRepository, EventStorageRepository>(); builder.Services.AddScoped <IMementoRepository, EventStorageRepository>(); builder.Services.AddScoped <IEventStorage, SqlEventStorage>(); return(builder); }
public static IShriekBuilder AddInfluxDbEventStorage(this IShriekBuilder builder, Action <InfluxDBOptions> optionAction) { var options = new InfluxDBOptions(); optionAction(options); builder.Services.AddScoped(x => options); builder.Services.AddScoped <InfluxDbContext>(); builder.Services.AddScoped <IEventStorageRepository, EventStorageRepository>(); builder.Services.AddScoped <IMementoRepository, MementoRepository>(); builder.Services.AddScoped <IEventStorage, SqlEventStorage>(); return(builder); }
public static IShriekBuilder AddWebApiProxy(this IShriekBuilder builder, Action <WebApiProxyOptions> optionAction) { var option = new WebApiProxyOptions(); optionAction(option); foreach (var o in option.WebApiProxies) { var types = o.GetType().Assembly.GetTypes().Where(x => x.IsInterface && x.GetMethods().SelectMany(m => m.GetCustomAttributes(typeof(ApiActionAttribute), true)).Any()); builder.Services.AddDynamicProxy(config => { config.Interceptors.AddTyped(typeof(HttpApiClient), new object[] { o.BaseUrl }, method => types.Any(t => t.IsAssignableFrom(method.DeclaringType))); }); } return(builder); }
public static IShriekBuilder AddWebApiProxy(this IShriekBuilder builder, Action <WebApiProxyOptions> optionAction) { var option = new WebApiProxyOptions(); optionAction(option); var webClient = new HttpApiClient(); foreach (var o in option.WebApiProxies) { var types = o.GetType().Assembly.GetTypes().Where(x => x.IsInterface && x.GetMethods().SelectMany(m => m.GetCustomAttributes(typeof(ApiActionAttribute), true)).Any()); foreach (var t in types) { builder.Services.AddScoped(t, x => webClient.GetHttpApi(t, o.BaseUrl)); } } return(builder); }
public static IShriekBuilder AddTcpServiceProxy(this IShriekBuilder builder, Action <TcpServiceProxyOptions> optionAction) { var option = new TcpServiceProxyOptions(); optionAction(option); foreach (var o in option.TcpProxys) { builder.Services.AddDynamicProxy(config => { var channelManager = new ChannelManager(o.Contract, o.Config); config.Interceptors.AddTyped(typeof(TcpServiceClient), o.socket == null ? new object[] { o.Server, o.Port, channelManager, o.Open } : new object[] { o.socket, channelManager, o.Open }, x => o.InterfaceType.IsAssignableFrom(x.DeclaringType)); }); } return(builder); }
public static IShriekBuilder AddSocketServer(this IShriekBuilder builder, Action <WebApiProxyOptions> optionAction) { builder.Services.AddSocketServer(optionAction); return(builder); }
public static IShriekBuilder AddScriptProxyGenerator(this IShriekBuilder builder) { return(builder); }