public static IServiceCollection AddAreaMap(this IServiceCollection services) =>
        services.AddSingleton(p =>
        {
            var options = p.GetOptions <TimelineAreaOptions>();

            return(AreaMap.From(options.Types));
        });
Example #2
0
        public static T Bind <T>(this T query, Id instanceId) where T : Query
        {
            var queryType = query.GetType();
            var areaMap   = AreaMap.From(new[] { queryType });

            AreaTypeName.TryFrom(queryType.Name, out var areaType);
            var flowType        = areaMap.GetFlow(areaType);
            var subscriptionKey = FlowKey.From(flowType, instanceId);

            FlowContext.Bind(query, subscriptionKey);
            return(query);
        }