Exemplo n.º 1
0
        private void ConfigureLlblgenPro(TenantStore tenantStore)
        {
            foreach (var tenant in tenantStore.GetTenants().Values)
            {
                var connectionString = Configuration.GetConnectionString(tenant.DbContext.ConnectionKey);
                RuntimeConfiguration.AddConnectionString(tenant.DbContext.ConnectionKey, connectionString);
                // Enable low-level (result set) caching when specified in selected queries
                // The cache of a query can be overwritten using property 'OverwriteIfPresent'
                CacheController.RegisterCache(connectionString, new ResultsetCache());
                CacheController.CachingEnabled = true;
            }

            if (WebHostEnvironment.IsProduction())
            {
                RuntimeConfiguration.ConfigureDQE <SD.LLBLGen.Pro.DQE.SqlServer.SQLServerDQEConfiguration>(c => c
                                                                                                           .SetTraceLevel(TraceLevel.Off)
                                                                                                           .AddDbProviderFactory(typeof(System.Data.SqlClient.SqlClientFactory)));
            }
            else
            {
                RuntimeConfiguration.ConfigureDQE <SD.LLBLGen.Pro.DQE.SqlServer.SQLServerDQEConfiguration>(c => c
                                                                                                           .SetTraceLevel(TraceLevel.Verbose)
                                                                                                           .AddDbProviderFactory(typeof(System.Data.SqlClient.SqlClientFactory)));

                RuntimeConfiguration.Tracing.SetTraceLevel("ORMPersistenceExecution", TraceLevel.Verbose);
                RuntimeConfiguration.Tracing.SetTraceLevel("ORMPlainSQLQueryExecution", TraceLevel.Verbose);
            }
        }
Exemplo n.º 2
0
        public Task <TreeNode <NavigationNode> > BuildTree(NavigationTreeBuilderService service)
        {
            var topNode = new NavigationNode {
                Text = _localizer["League"], Url = "/#"
            };
            var treeNode = new TreeNode <NavigationNode>(topNode);

            treeNode.AddChild(new NavigationNode {
                Text = _localizer["Home"], Url = "/welcome", Key = "LeagueWelcome"
            });
            foreach (var tenant in _tenantStore.GetTenants().Values)
            {
                if (!string.IsNullOrEmpty(tenant.Identifier) && !tenant.SiteContext.HideInMenu)
                {
                    treeNode.AddChild(
                        new NavigationNode
                    {
                        Text = tenant.OrganizationContext.ShortName,
                        Url  = "/" + tenant.SiteContext.UrlSegmentValue,
                        Key  = "UrlSegment_" + tenant.SiteContext.UrlSegmentValue,
                        PreservedRouteParameters = "organization",
                    });
                }
            }
            treeNode.AddChild(new NavigationNode {
                Text = _localizer["League Overview"], Url = "/overview", Key = "LeagueOverview"
            });

            // To return a TreeNode, that won't be rendered, use: new TreeNode<NavigationNode>(new NavigationNode());
            return(Task.FromResult(treeNode));
        }
Exemplo n.º 3
0
        public IActionResult Index()
        {
            if (Request.Cookies.TryGetValue(CookieNames.MostRecentTenant, out var urlSegmentValue) && _tenantStore.GetTenants().Any(sl => sl.Value.SiteContext.UrlSegmentValue == urlSegmentValue))
            {
                if (!string.IsNullOrEmpty(urlSegmentValue))
                {
                    return(Redirect($"/{urlSegmentValue}"));
                }
            }

            return(Redirect(Url.Action(nameof(Welcome), nameof(Home))));
        }