Internal class used by RouteResolver.
示例#1
0
 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);
     }
 }
示例#2
0
 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 );
 }
示例#3
0
 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>();
 }
示例#4
0
 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>();
 }
示例#5
0
 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);
     }
 }
示例#6
0
 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 );
     }
 }
示例#7
0
 internal Route( ProtoResolver r, RouteConfiguration c )
     : this( c, null, r )
 {
     CheckValidity();
 }
示例#8
0
 internal Route(ProtoResolver r, RouteConfiguration c)
     : this(c, null, r)
 {
     CheckValidity();
 }