public RouteResolver(IActivityMonitor monitor, RouteConfiguration c) { try { using (monitor.OpenGroup(LogLevel.Info, c.Name.Length > 0 ? string.Format("Resolving root configuration (name is '{0}').", c.Name) : "Resolving root configuration.", null)) { ProtoResolver protoResolver = new ProtoResolver(monitor, c); NamedSubRoutes = new Dictionary <string, SubRouteConfigurationResolved>(); using (monitor.OpenGroup(LogLevel.Info, "Building final routes.", null)) { var preRoot = new PreRoute(monitor, protoResolver.Root); Root = new RouteConfigurationResolved(protoResolver.Root.FullName, c.ConfigData, preRoot.FinalizeActions()); foreach (IProtoSubRoute sub in protoResolver.NamedSubRoutes.Values) { var preRoute = new PreRoute(monitor, sub); NamedSubRoutes.Add(sub.FullName, new SubRouteConfigurationResolved(sub, preRoute.FinalizeActions())); } Root.SubRoutes = protoResolver.Root.SubRoutes.Select(p => NamedSubRoutes[p.FullName]).ToArray(); foreach (IProtoSubRoute sub in protoResolver.NamedSubRoutes.Values) { NamedSubRoutes[sub.FullName].SubRoutes = sub.SubRoutes.Select(p => NamedSubRoutes[p.FullName]).ToArray(); } } } } catch (Exception ex) { monitor.SendLine(LogLevel.Fatal, null, ex); } }
internal Route( ProtoResolver r, Route parent, SubRouteConfiguration c ) : this( c, parent, r ) { _routeDepth = parent._routeDepth + 1; _namespace = parent._namespace + c.Namespace; _fullName = parent._namespace + _fullName; CheckValidity(); if( c.ImportParentDeclaredActionsAbove ) _declaredActions.AddRange( _parent._declaredActions ); if( c.ImportParentActions ) _metaConfigurations.AddRange( parent._metaConfigurations ); }
Route( RouteConfiguration c, Route parent, ProtoResolver r ) { _resolver = r; _parent = parent; _configuration = c; _routeDepth = 0; _namespace = c.Namespace; _fullName = c.Namespace + c.Name; _declaredActions = new Dictionary<string, ProtoDeclaredAction>(); _metaConfigurations = new List<MetaConfiguration>(); _subRoutes = new List<Route>(); }
Route(RouteConfiguration c, Route parent, ProtoResolver r) { _resolver = r; _parent = parent; _configuration = c; _routeDepth = 0; _namespace = c.Namespace; _fullName = c.Namespace + c.Name; _declaredActions = new Dictionary <string, ProtoDeclaredAction>(); _metaConfigurations = new List <MetaConfiguration>(); _subRoutes = new List <Route>(); }
internal Route(ProtoResolver r, Route parent, SubRouteConfiguration c) : this(c, parent, r) { _routeDepth = parent._routeDepth + 1; _namespace = parent._namespace + c.Namespace; _fullName = parent._namespace + _fullName; CheckValidity(); if (c.ImportParentDeclaredActionsAbove) { _declaredActions.AddRange(_parent._declaredActions); } if (c.ImportParentActions) { _metaConfigurations.AddRange(parent._metaConfigurations); } }
public RouteResolver( IActivityMonitor monitor, RouteConfiguration c ) { try { using( monitor.OpenGroup( LogLevel.Info, c.Name.Length > 0 ? string.Format( "Resolving root configuration (name is '{0}').", c.Name ) : "Resolving root configuration.", null ) ) { ProtoResolver protoResolver = new ProtoResolver( monitor, c ); NamedSubRoutes = new Dictionary<string, SubRouteConfigurationResolved>(); using( monitor.OpenGroup( LogLevel.Info, "Building final routes.", null ) ) { var preRoot = new PreRoute( monitor, protoResolver.Root ); Root = new RouteConfigurationResolved( protoResolver.Root.FullName, c.ConfigData, preRoot.FinalizeActions() ); foreach( IProtoSubRoute sub in protoResolver.NamedSubRoutes.Values ) { var preRoute = new PreRoute( monitor, sub ); NamedSubRoutes.Add( sub.FullName, new SubRouteConfigurationResolved( sub, preRoute.FinalizeActions() ) ); } Root.SubRoutes = protoResolver.Root.SubRoutes.Select( p => NamedSubRoutes[p.FullName] ).ToArray(); foreach( IProtoSubRoute sub in protoResolver.NamedSubRoutes.Values ) { NamedSubRoutes[sub.FullName].SubRoutes = sub.SubRoutes.Select( p => NamedSubRoutes[p.FullName] ).ToArray(); } } } } catch( Exception ex ) { monitor.SendLine( LogLevel.Fatal, null, ex ); } }
internal Route( ProtoResolver r, RouteConfiguration c ) : this( c, null, r ) { CheckValidity(); }
internal Route(ProtoResolver r, RouteConfiguration c) : this(c, null, r) { CheckValidity(); }