Beispiel #1
0
        static void Main(string[] arguments) {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            SecurityDemoWindowsFormsApplication application = new SecurityDemoWindowsFormsApplication();
            application.CreateCustomTemplate += new EventHandler<CreateCustomTemplateEventArgs>(xafApplication_CreateCustomTemplate);
            application.CreateCustomLogonWindowObjectSpace += new EventHandler<CreateCustomLogonWindowObjectSpaceEventArgs>(application_CreateCustomLogonWindowObjectSpace);
            application.CreateCustomLogonWindowControllers += new EventHandler<CreateCustomLogonWindowControllersEventArgs>(application_CreateCustomLogonWindowControllers);

            try {
                application.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;

                //The functionality is build in the XpandObjectSpaceProvider. To enable or disable use Model/Options/ClientSideSecurity. You can continue using the designer if you want.



                //                SecurityStrategyComplex security = new SecurityStrategyComplex(typeof(SecurityDemoUser), typeof(DevExpress.ExpressApp.Security.Strategy.SecuritySystemRole), new SecurityDemoAuthentication());
                //                application.Security = security;

                //                application.CreateCustomObjectSpaceProvider += delegate(object sender, CreateCustomObjectSpaceProviderEventArgs e) {
                //                    e.ObjectSpaceProvider = new SecuredObjectSpaceProvider(security, e.ConnectionString, e.Connection);
                //                };
                application.DatabaseVersionMismatch += delegate(object sender, DatabaseVersionMismatchEventArgs e) {
                    e.Updater.Update();
                    e.Handled = true;
                };

                application.Setup();
                application.Start();
            } catch (Exception e) {
                application.HandleException(e);
            }
        }
Beispiel #2
0
        static void Main(string[] arguments)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            SecurityDemoWindowsFormsApplication application = new SecurityDemoWindowsFormsApplication();

            application.CreateCustomTemplate += new EventHandler <CreateCustomTemplateEventArgs>(xafApplication_CreateCustomTemplate);
            application.CreateCustomLogonWindowObjectSpace += new EventHandler <CreateCustomLogonWindowObjectSpaceEventArgs>(application_CreateCustomLogonWindowObjectSpace);
            application.CreateCustomLogonWindowControllers += new EventHandler <CreateCustomLogonWindowControllersEventArgs>(application_CreateCustomLogonWindowControllers);

            try {
                application.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;

                SecurityStrategyComplex security = new SecurityStrategyComplex(typeof(SecurityDemoUser), typeof(DevExpress.ExpressApp.Security.Strategy.SecuritySystemRole), new SecurityDemoAuthentication());
                application.Security = security;
                //                application.CreateCustomObjectSpaceProvider += delegate(object sender, CreateCustomObjectSpaceProviderEventArgs e) {
                //                    e.ObjectSpaceProvider = new SecuredObjectSpaceProvider(security, e.ConnectionString, e.Connection);
                //                };
                application.DatabaseVersionMismatch += delegate(object sender, DatabaseVersionMismatchEventArgs e) {
                    e.Updater.Update();
                    e.Handled = true;
                };

                application.Setup();
                application.Start();
            } catch (Exception e) {
                application.HandleException(e);
            }
        }
Beispiel #3
0
		static void Main(string[] arguments) {
			Application.EnableVisualStyles();
			Application.SetCompatibleTextRenderingDefault(false);
            KnownTypesProvider.KnownTypes.Add(typeof(SecurityDemoAuthenticationLogonParameters));
			SecurityDemoWindowsFormsApplication application = new SecurityDemoWindowsFormsApplication();
            application.CreateCustomTemplate += new EventHandler<CreateCustomTemplateEventArgs>(xafApplication_CreateCustomTemplate);
            application.CreateCustomLogonWindowObjectSpace += new EventHandler<CreateCustomLogonWindowObjectSpaceEventArgs>(application_CreateCustomLogonWindowObjectSpace);
            application.CreateCustomLogonWindowControllers += new EventHandler<CreateCustomLogonWindowControllersEventArgs>(application_CreateCustomLogonWindowControllers);

			if(ConfigurationManager.ConnectionStrings["ConnectionString"] != null) {
				application.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
			}

			try {
                ApplicationServerStarter starter = new ApplicationServerStarter();
                starter.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
                starter.ServerConnectionString = ConfigurationManager.ConnectionStrings["ServerConnectionString"].ConnectionString;
                starter.Start();

                new MiddleTierClientApplicationConfigurator(application);
			    ((ISupportFullConnectionString) application).ConnectionString =
			        ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
				application.Setup();
				application.Start();
			}
			catch(Exception e) {
				application.HandleException(e);
			}
		}
Beispiel #4
0
        static void Main(string[] arguments)
        {
#if EasyTest
            DevExpress.ExpressApp.Win.EasyTest.EasyTestRemotingRegistration.Register();
#endif
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            SecurityDemoWindowsFormsApplication application = new SecurityDemoWindowsFormsApplication();
            application.CreateCustomTemplate += new EventHandler <CreateCustomTemplateEventArgs>(xafApplication_CreateCustomTemplate);
            application.CreateCustomLogonWindowObjectSpace += new EventHandler <CreateCustomLogonWindowObjectSpaceEventArgs>(application_CreateCustomLogonWindowObjectSpace);
            application.CreateCustomLogonWindowControllers += new EventHandler <CreateCustomLogonWindowControllersEventArgs>(application_CreateCustomLogonWindowControllers);

            try {
#if EasyTest
                if (ConfigurationManager.ConnectionStrings["EasyTestConnectionString"] != null)
                {
                    application.ConnectionString = ConfigurationManager.ConnectionStrings["EasyTestConnectionString"].ConnectionString;
                }
#else
                if (ConfigurationManager.ConnectionStrings["ConnectionString"] != null)
                {
                    application.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
                }
#endif


                SecurityStrategyComplex security = new SecurityStrategyComplex(typeof(PermissionPolicyUser), typeof(PermissionPolicyRole), new SecurityDemoAuthentication());
                application.Security = security;
                application.CreateCustomObjectSpaceProvider += delegate(object sender, CreateCustomObjectSpaceProviderEventArgs e) {
                    e.ObjectSpaceProvider = new SecuredObjectSpaceProvider(security, e.ConnectionString, e.Connection, false);
                };
                application.DatabaseVersionMismatch += delegate(object sender, DatabaseVersionMismatchEventArgs e) {
                    try {
                        e.Updater.Update();
                        e.Handled = true;
                    }
                    catch (CompatibilityException exception) {
                        if (exception.Error is CompatibilityUnableToOpenDatabaseError)
                        {
                            throw new UserFriendlyException(
                                      "The connection to the database failed. This demo requires the local instance of Microsoft SQL Server Express. To use another database server,\r\nopen the demo solution in Visual Studio and modify connection string in the \"app.config\" file.");
                        }
                    }
                };

                if (System.Diagnostics.Debugger.IsAttached && application.CheckCompatibilityType == CheckCompatibilityType.DatabaseSchema)
                {
                    application.DatabaseUpdateMode = DatabaseUpdateMode.UpdateDatabaseAlways;
                }

                application.Setup();
                application.Start();
            }
            catch (Exception e) {
                application.HandleException(e);
            }
        }
Beispiel #5
0
        private static void Main(){
#if EASYTEST
			DevExpress.ExpressApp.Win.EasyTest.EasyTestRemotingRegistration.Register();
#endif
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var application = new SecurityDemoWindowsFormsApplication();
            application.CreateCustomTemplate += xafApplication_CreateCustomTemplate;
            application.CreateCustomLogonWindowObjectSpace += application_CreateCustomLogonWindowObjectSpace;
            application.CreateCustomLogonWindowControllers += application_CreateCustomLogonWindowControllers;
#if EASYTEST
			if(ConfigurationManager.ConnectionStrings["EasyTestConnectionString"] != null) {
				application.ConnectionString = ConfigurationManager.ConnectionStrings["EasyTestConnectionString"].ConnectionString;
			}
#else
            if (ConfigurationManager.ConnectionStrings["ConnectionString"] != null){
                application.ConnectionString =
                    ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
            }
#endif
            try{
                var security = new SecurityStrategyComplex(typeof (SecuritySystemUser), typeof (SecuritySystemRole),
                    new SecurityDemoAuthentication());
                application.Security = security;

                //                This functionality is build in the XpandObjectSpaceProvider. To enable or disable use Model/Options/ClientSideSecurity. You can continue using the designer if you want.

                //                application.CreateCustomObjectSpaceProvider += delegate(object sender, CreateCustomObjectSpaceProviderEventArgs e) {
                //                    e.ObjectSpaceProvider = new SecuredObjectSpaceProvider(security, e.ConnectionString, e.Connection);
                //                };
                application.DatabaseVersionMismatch += delegate(object sender, DatabaseVersionMismatchEventArgs e){
                    try{
#if EASYTEST
                        e.Updater.Update();
                        e.Handled = true;
#else
                        if (Debugger.IsAttached){
                            e.Updater.Update();
                            e.Handled = true;
                        }
#endif
                    }
                    catch (CompatibilityException exception){
                        if (exception.Error is CompatibilityUnableToOpenDatabaseError){
                            throw new UserFriendlyException(
                                "The connection to the database failed. This demo requires the local instance of Microsoft SQL Server Express. To use another database server,\r\nopen the demo solution in Visual Studio and modify connection string in the \"app.config\" file.");
                        }
                    }
                };

                application.Setup();
                application.Start();
            }
            catch (Exception e){
                application.HandleException(e);
            }
        }
Beispiel #6
0
        private static void Main()
        {
#if EASYTEST
            DevExpress.ExpressApp.Win.EasyTest.EasyTestRemotingRegistration.Register();
#endif
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var application = new SecurityDemoWindowsFormsApplication();
            application.CreateCustomTemplate += xafApplication_CreateCustomTemplate;
            application.CreateCustomLogonWindowObjectSpace += application_CreateCustomLogonWindowObjectSpace;
            application.CreateCustomLogonWindowControllers += application_CreateCustomLogonWindowControllers;
#if EASYTEST
            if (ConfigurationManager.ConnectionStrings["EasyTestConnectionString"] != null)
            {
                application.ConnectionString = ConfigurationManager.ConnectionStrings["EasyTestConnectionString"].ConnectionString;
            }
#else
            if (ConfigurationManager.ConnectionStrings["ConnectionString"] != null)
            {
                application.ConnectionString =
                    ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
            }
#endif
            try{
                var security = new SecurityStrategyComplex(typeof(SecuritySystemUser), typeof(SecuritySystemRole),
                                                           new SecurityDemoAuthentication());
                application.Security = security;

                //                This functionality is build in the XpandObjectSpaceProvider. To enable or disable use Model/Options/ClientSideSecurity. You can continue using the designer if you want.

                //                application.CreateCustomObjectSpaceProvider += delegate(object sender, CreateCustomObjectSpaceProviderEventArgs e) {
                //                    e.ObjectSpaceProvider = new SecuredObjectSpaceProvider(security, e.ConnectionString, e.Connection);
                //                };
                application.DatabaseVersionMismatch += delegate(object sender, DatabaseVersionMismatchEventArgs e){
                    try{
#if EASYTEST
                        e.Updater.Update();
                        e.Handled = true;
#else
                        if (Debugger.IsAttached)
                        {
                            e.Updater.Update();
                            e.Handled = true;
                        }
#endif
                    }
                    catch (CompatibilityException exception) {
                        if (exception.Error is CompatibilityUnableToOpenDatabaseError)
                        {
                            throw new UserFriendlyException(
                                      "The connection to the database failed. This demo requires the local instance of Microsoft SQL Server Express. To use another database server,\r\nopen the demo solution in Visual Studio and modify connection string in the \"app.config\" file.");
                        }
                    }
                };

                application.Setup();
                application.Start();
            }
            catch (Exception e) {
                application.HandleException(e);
            }
        }