Example #1
0
 public void Configure(BehaviorGraph graph)
 {
     graph.Routes.Resources.Where(x => TypeExtensions.CanBeCastTo <DownloadFileModel>(x.ResourceType()))
     .Each(x => x.AddToEnd(new DownloadFileNode()));
 }
Example #2
0
        public MiddlewareAttribute(params Type[] frameTypes)
        {
            var notMatching = frameTypes.Where(x => !TypeExtensions.IsConcreteWithDefaultCtor(x) || !TypeExtensions.CanBeCastTo <Frame>(x)).ToArray();

            if (notMatching.Any())
            {
                throw new ArgumentOutOfRangeException($"Invalid Frame types: {notMatching.Select(x => x.FullName).Join(", ")}");
            }

            _frameTypes = frameTypes;
        }