Ejemplo n.º 1
0
 public static void RegisterTenantViewAssemblyPart(ApplicationPartManager manager, [WebPartConfig("ContextSettings")] SecurityContextOptions options)
 {
     if (!string.IsNullOrEmpty(options?.ContextType))
     {
         var dic = new Dictionary <string, object>();
         var t   = (Type)ExpressionParser.Parse(options.ContextType, dic);
         manager.EnableItvTenantViews(t);
     }
     else
     {
         throw new InvalidOperationException("Unable to register Views without a Context-Type");
     }
 }
Ejemplo n.º 2
0
        public static void RegisterServices(IServiceCollection services, [WebPartConfig("ContextSettings")] SecurityContextOptions contextOptions,
                                            [WebPartConfig("ActivationSettings")] ActivationOptions partActivation)
        {
            Type t = null;

            if (!string.IsNullOrEmpty(contextOptions.ContextType))
            {
                var dic = new Dictionary <string, object>();
                t = (Type)ExpressionParser.Parse(contextOptions.ContextType, dic);
            }

            if (partActivation.ActivateDbContext)
            {
                if (t != null)
                {
                    services.UseDbIdentities(t, options => options.UseSqlServer(partActivation.ConnectionStringName));
                }
                else
                {
                    services.UseDbIdentities(options => options.UseSqlServer(partActivation.ConnectionStringName));
                }
            }

            if (partActivation.UseNavigation)
            {
                if (t != null)
                {
                    services.UseDbNavigation(t);
                }
                else
                {
                    services.UseDbNavigation();
                }
            }

            if (partActivation.UsePlugins)
            {
                services.UseDbPlugins();
            }

            if (partActivation.UseGlobalSettings)
            {
                services.UseDbGlobalSettings();
            }

            if (partActivation.UseTenantSettings)
            {
                services.UseTenantSettings();
            }

            if (partActivation.UseLogAdapter)
            {
                services.UseDbLogAdapter();
            }

            /*if (!string.IsNullOrEmpty(options?.ContextType))
             * {
             *  var dic = new Dictionary<string, object>();
             *  var t = (Type)ExpressionParser.Parse(options.ContextType, dic);
             *  manager.EnableItvUserView(t);
             * }
             * else
             * {
             *  manager.EnableItvUserView();
             * }*/
        }
Ejemplo n.º 3
0
 public static void RegisterTenantViewAssemblyPart(ApplicationPartManager manager, SecurityContextOptions options)
 {
     if (!string.IsNullOrEmpty(options?.ContextType))
     {
         var dic = new Dictionary <string, object>();
         var t   = (Type)ExpressionParser.Parse(options.ContextType, dic);
         manager.EnableItvUserView(t);
     }
     else
     {
         manager.EnableItvUserView();
     }
 }