Пример #1
0
        private void Initialize()
        {
            //Navigation providers should be registered
            _iocManager.Register <MyNavigationProvider1>();
            _iocManager.Register <MyNavigationProvider2>();

            //Preparing navigation configuration
            var configuration = new NavigationConfiguration();

            configuration.Providers.Add <MyNavigationProvider1>();
            configuration.Providers.Add <MyNavigationProvider2>();

            //Initializing navigation manager
            NavigationManager = new NavigationManager(_iocManager, configuration);
            NavigationManager.Initialize();

            _iocManager.IocContainer.Register(
                Component.For <IFeatureDependencyContext, FeatureDependencyContext>()
                .UsingFactoryMethod(
                    () => new FeatureDependencyContext(_iocManager, Substitute.For <IFeatureChecker>()))
                );

            //Create user navigation manager to test
            UserNavigationManager = new UserNavigationManager(NavigationManager, Substitute.For <ILocalizationContext>(), _iocManager)
            {
                PermissionChecker = CreateMockPermissionChecker()
            };
        }
 protected NavigationModelBuilderBase(
     UmbracoHelper umbracoHelper,
     IConfigurationProvider <NavigationConfiguration> navigationConfigurationProvider)
 {
     _umbracoHelper          = umbracoHelper;
     NavigationConfiguration = navigationConfigurationProvider.GetSettings();
 }
Пример #3
0
        /// <summary>���캯��</summary>
        public NavigationPortalTopMenuProvider()
        {
            this.configuration = NavigationConfigurationView.Instance.Configuration;

            this.ibatisMapping = this.configuration.Keys["IBatisMapping"].Value;

            this.ibatisMapper = ISqlMapHelper.CreateSqlMapper(this.ibatisMapping);
        }
 public HomeNavigationCompositionService(
     IContentTypeService contentTypeService,
     IDataTypeService dataTypeService,
     IConfigurationProvider <NavigationConfiguration> navigationConfigurationProvider
     ) : base(contentTypeService, dataTypeService)
 {
     _navigationConfiguration = navigationConfigurationProvider.GetSettings();
 }
Пример #5
0
        /// <summary>重新加载</summary>
        private void Reload()
        {
            configuration = NavigationConfigurationView.Instance.Configuration;

            this.m_NavigationPortalService                 = SpringContext.Instance.GetObject <INavigationPortalService>(typeof(INavigationPortalService));
            this.m_NavigationPortalTopMenuService          = SpringContext.Instance.GetObject <INavigationPortalTopMenuService>(typeof(INavigationPortalTopMenuService));
            this.m_NavigationPortalShortcutGroupService    = SpringContext.Instance.GetObject <INavigationPortalShortcutGroupService>(typeof(INavigationPortalShortcutGroupService));
            this.m_NavigationPortalShortcutService         = SpringContext.Instance.GetObject <INavigationPortalShortcutService>(typeof(INavigationPortalShortcutService));
            this.m_NavigationPortalSidebarItemGroupService = SpringContext.Instance.GetObject <INavigationPortalSidebarItemGroupService>(typeof(INavigationPortalSidebarItemGroupService));
            this.m_NavigationPortalSidebarItemService      = SpringContext.Instance.GetObject <INavigationPortalSidebarItemService>(typeof(INavigationPortalSidebarItemService));
        }
Пример #6
0
        private void Initialize()
        {
            //Navigation providers should be registered
            _iocManager.Register <MyNavigationProvider1>();
            _iocManager.Register <MyNavigationProvider2>();

            //Preparing navigation configuration
            var configuration = new NavigationConfiguration();

            configuration.Providers.Add <MyNavigationProvider1>();
            configuration.Providers.Add <MyNavigationProvider2>();

            //Initializing navigation manager
            NavigationManager = new NavigationManager(_iocManager, configuration);
            NavigationManager.Initialize();

            //Create user navigation manager to test
            UserNavigationManager = new UserNavigationManager(CreateMockPermissionManager(), NavigationManager);
        }
Пример #7
0
        public virtual string ConstructNavigationConfiguration([NotNull] NavigationConfiguration navigationConfiguration)
        {
            Check.NotNull(navigationConfiguration, nameof(navigationConfiguration));

            var sb = new StringBuilder();

            sb.Append("Reference");
            sb.Append("(d => d.");
            sb.Append(navigationConfiguration.DependentEndNavigationPropertyName);
            sb.Append(")");

            if (navigationConfiguration.ForeignKey.IsUnique)
            {
                sb.Append(".InverseReference(");
            }
            else
            {
                sb.Append(".InverseCollection(");
            }
            if (!string.IsNullOrEmpty(navigationConfiguration.PrincipalEndNavigationPropertyName))
            {
                sb.Append("p => p.");
                sb.Append(navigationConfiguration.PrincipalEndNavigationPropertyName);
            }
            sb.Append(")");

            sb.Append(".ForeignKey");
            if (navigationConfiguration.ForeignKey.IsUnique)
            {
                // If the relationship is 1:1 need to define to which end
                // the ForeignKey properties belong.
                sb.Append("<");
                sb.Append(navigationConfiguration.EntityConfiguration.EntityType.DisplayName());
                sb.Append(">");
            }

            sb.Append("(d => ");
            sb.Append(GenerateLambdaToKey(navigationConfiguration.ForeignKey.Properties, "d"));
            sb.Append(")");

            return(sb.ToString());
        }
Пример #8
0
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            // Service setup
            services.AddPiranha(options =>
            {
                options.AddRazorRuntimeCompilation = true;
                options.UseFileStorage();
                options.UseImageSharp();
                options.UseManager();
                options.UseTinyMCE();
                options.UseMemoryCache();
                options.UseEF <SQLiteDb>(db =>
                                         db.UseSqlite(Configuration.GetConnectionString("piranha")));
                options.UseIdentityWithSeed <IdentitySQLiteDb>(db =>
                                                               db.UseSqlite(Configuration.GetConnectionString("piranha")));
            });
            var config = new NavigationConfiguration();

            Configuration.Bind("Navigation", config);
            services.AddSingleton(config);
        }
Пример #9
0
        /// <summary>
        /// 初始化
        /// </summary>
        private void Initialize()
        {
            //导航提供者应该被注册
            _iocManager.Register <MyNavigationProvider1>();
            _iocManager.Register <MyNavigationProvider2>();
            //准备导航配置
            var configuration = new NavigationConfiguration();

            configuration.Providers.Add <MyNavigationProvider1>();
            configuration.Providers.Add <MyNavigationProvider2>();
            //初始化导航管理
            NavigationManager = new NavigationManager(_iocManager, configuration);
            NavigationManager.Initialize();

            _iocManager.IocContainer.Register(Component.For <IFeatureDependencyContext, FeatureDependencyContext>()
                                              .UsingFactoryMethod(() => new FeatureDependencyContext(_iocManager, Substitute.For <IFeatureChecker>()))); //伪造一个IFeatureChecker
            //创建用户导航管理用于测试
            UserNavigationManager = new UserNavigationManager(NavigationManager, Substitute.For <ILocalizationContext>(), _iocManager)
            {
                PermissionChecker = CreateMockPermissionChecker()
            };
        }
Пример #10
0
        /// <summary>���캯��</summary>
        public NavigationPortalTopMenuService()
        {
            this.configuration = NavigationConfigurationView.Instance.Configuration;

            this.provider = SpringContext.Instance.GetObject <INavigationPortalTopMenuProvider>(typeof(INavigationPortalTopMenuProvider));
        }