Exemple #1
0
        protected void Session_Start(Object sender, EventArgs e)
        {
            WebApplication.SetInstance(Session, new SecurityDemoAspNetApplication());
            WebApplication.Instance.CreateCustomLogonWindowObjectSpace += new EventHandler <CreateCustomLogonWindowObjectSpaceEventArgs>(Instance_CreateCustomLogonWindowObjectSpace);
            WebApplication.Instance.CreateCustomLogonWindowControllers += new EventHandler <CreateCustomLogonWindowControllersEventArgs>(Instance_CreateCustomLogonWindowControllers);

#if EASYTEST
            if (ConfigurationManager.ConnectionStrings["EasyTestConnectionString"] != null)
            {
                WebApplication.Instance.ConnectionString = ConfigurationManager.ConnectionStrings["EasyTestConnectionString"].ConnectionString;
            }
#else
            if (ConfigurationManager.AppSettings["SiteMode"] != null && ConfigurationManager.AppSettings["SiteMode"].ToLower() == "true")
            {
                InMemoryDataStoreProvider.Register();
                WebApplication.Instance.ConnectionString = InMemoryDataStoreProvider.ConnectionString;
            }
            else
            {
                if (ConfigurationManager.ConnectionStrings["ConnectionString"] != null)
                {
                    WebApplication.Instance.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
                }
            }
#endif
            SecurityStrategyComplex security = new SecurityStrategyComplex(typeof(SecuritySystemUser), typeof(DevExpress.ExpressApp.Security.Strategy.SecuritySystemRole), new SecurityDemoAuthentication());
            WebApplication.Instance.Security = security;
            WebApplication.Instance.DatabaseVersionMismatch += delegate(object sender2, DatabaseVersionMismatchEventArgs e2) {
                try {
                    e2.Updater.Update();
                    e2.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.");
                    }
                }
            };

//            WebApplication.Instance.CreateCustomObjectSpaceProvider += delegate(object sender3, CreateCustomObjectSpaceProviderEventArgs e3) {
//                e3.ObjectSpaceProvider = new SecuredObjectSpaceProvider(security, e3.ConnectionString, e3.Connection);
//            };

            WebApplication.Instance.Setup();
            WebApplication.Instance.Start();
        }
Exemple #2
0
 static void Main()
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     EditModelPermission.AlwaysGranted = System.Diagnostics.Debugger.IsAttached;
     CalculatedAliasWindowsFormsApplication winApplication = new CalculatedAliasWindowsFormsApplication();
     try {
         InMemoryDataStoreProvider.Register();
         winApplication.ConnectionString = InMemoryDataStoreProvider.ConnectionString;
         winApplication.Setup();
         winApplication.Start();
     }
     catch(Exception e) {
         winApplication.HandleException(e);
     }
 }
Exemple #3
0
        static void Main()
        {
#if EASYTEST
            DevExpress.ExpressApp.Win.EasyTest.EasyTestRemotingRegistration.Register();
#endif
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            EmployeeAsUserExampleWindowsFormsApplication winApplication = new EmployeeAsUserExampleWindowsFormsApplication();
            try {
                InMemoryDataStoreProvider.Register();
                winApplication.ConnectionString = InMemoryDataStoreProvider.ConnectionString;
                winApplication.Setup();
                winApplication.Start();
            }
            catch (Exception e) {
                winApplication.HandleException(e);
            }
        }
        protected void Session_Start(Object sender, EventArgs e)
        {
            WebApplication.SetInstance(Session, new E689AspNetApplication());
#if EASYTEST
            if (ConfigurationManager.ConnectionStrings["EasyTestConnectionString"] != null)
            {
                WebApplication.Instance.ConnectionString = ConfigurationManager.ConnectionStrings["EasyTestConnectionString"].ConnectionString;
            }
#endif
            InMemoryDataStoreProvider.Register();
            WebApplication.Instance.ConnectionString = InMemoryDataStoreProvider.ConnectionString;
            if (ConfigurationManager.ConnectionStrings["ConnectionString"] != null)
            {
                WebApplication.Instance.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
            }
            WebApplication.Instance.Setup();
            WebApplication.Instance.Start();
        }
Exemple #5
0
        protected override void CreateDefaultObjectSpaceProvider(CreateCustomObjectSpaceProviderEventArgs args)
        {
            string xpoConnectionString = DbEngineDetector.PatchConnectionString(ConfigurationManager.ConnectionStrings["ConnectionStringXpo"].ConnectionString);
            string efConnectionString  = DbEngineDetector.PatchConnectionString(ConfigurationManager.ConnectionStrings["ConnectionStringEF"].ConnectionString);

            if (Global.IsSiteMode())
            {
                InMemoryDataStoreProvider.Register();
                xpoConnectionString = InMemoryDataStoreProvider.ConnectionString;
                var efConnectionStringItem = ConfigurationManager.ConnectionStrings["SimpleProjectManagerSiteModeConnectionStringEF"];
                if (efConnectionStringItem == null)
                {
                    throw new Exception("The 'SimpleProjectManagerSiteModeConnectionStringEF' item is missing in the configuration file!");
                }
                efConnectionString = efConnectionStringItem.ConnectionString;
            }
            args.ObjectSpaceProviders.Add(new XPObjectSpaceProvider(xpoConnectionString, null, true));
            args.ObjectSpaceProviders.Add(new EFObjectSpaceProvider(typeof(SimpleProjectManagerDbContext), efConnectionString));
        }
        static void Main()
        {
#if EASYTEST
            DevExpress.ExpressApp.Win.EasyTest.EasyTestRemotingRegistration.Register();
#endif
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            EditModelPermission.AlwaysGranted = System.Diagnostics.Debugger.IsAttached;
            HowToImplementSingletonWindowsFormsApplication application = new HowToImplementSingletonWindowsFormsApplication();
            try {
                InMemoryDataStoreProvider.Register();
                application.ConnectionString = InMemoryDataStoreProvider.ConnectionString;
                application.Setup();
                application.Start();
            }
            catch (Exception e) {
                application.HandleException(e);
            }
        }
        protected virtual string GetConnectionString()
        {
            if (ConfigurationManager.ConnectionStrings["ConnectionString"] != null)
            {
                return(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
            }
#if (UseEasyTest)
//-:cnd:noEmit
#if EASYTEST
            if (ConfigurationManager.ConnectionStrings["EasyTestConnectionString"] != null)
            {
                return(ConfigurationManager.ConnectionStrings["EasyTestConnectionString"].ConnectionString);
            }
//+:cnd:noEmit
#endif
#endif
            InMemoryDataStoreProvider.Register();
            return(InMemoryDataStoreProvider.ConnectionString);
        }
Exemple #8
0
        protected void Session_Start(Object sender, EventArgs e)
        {
            Tracing.Initialize();
            WebApplication.SetInstance(Session, new ReportV2DemoAspNetApplication());
            ScriptPermissionManager.GlobalInstance = new ScriptPermissionManager(ExecutionMode.Unrestricted);
            if (HttpContext.Current.Request.Params.AllKeys.Contains("NewStyle"))
            {
                WebApplication.Instance.SwitchToNewStyle();
            }
            if (ConfigurationManager.AppSettings["SiteMode"] != null && ConfigurationManager.AppSettings["SiteMode"].ToLower() == "true")
            {
                InMemoryDataStoreProvider.Register();
                WebApplication.Instance.ConnectionString = InMemoryDataStoreProvider.ConnectionString;
            }
            else
            {
                ConnectionStringSettings connectionStringSettings = ConfigurationManager.ConnectionStrings["ConnectionString"];
                if (connectionStringSettings != null)
                {
                    WebApplication.Instance.ConnectionString = connectionStringSettings.ConnectionString;
                }
                else if (string.IsNullOrEmpty(WebApplication.Instance.ConnectionString) && WebApplication.Instance.Connection == null)
                {
                    connectionStringSettings = ConfigurationManager.ConnectionStrings["SqlExpressConnectionString"];
                    if (connectionStringSettings != null)
                    {
                        WebApplication.Instance.ConnectionString = DbEngineDetector.PatchConnectionString(connectionStringSettings.ConnectionString);
                    }
                }
                #region DEMO_REMOVE
                WebApplication.Instance.ConnectionString = InMemoryDataStoreProvider.ConnectionString;
                #endregion
            }

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

            InitializeSecurity(WebApplication.Instance);
            WebApplication.Instance.Setup();
            WebApplication.Instance.Start();
        }
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            EditModelPermission.AlwaysGranted = System.Diagnostics.Debugger.IsAttached;
            MyDetailsController.CanGenerateMyDetailsNavigationItem       = true;
            ObjectAccessComparer.AllowModifyCurrentUserObjectDefault     = true;
            ObjectAccessComparer.AllowNavigateToCurrentUserObjectDefault = true;
            WinSolutionWindowsFormsApplication winApplication = new WinSolutionWindowsFormsApplication();

            try {
                InMemoryDataStoreProvider.Register();
                winApplication.ConnectionString = InMemoryDataStoreProvider.ConnectionString;
                winApplication.Setup();
                winApplication.Start();
            }
            catch (Exception e) {
                winApplication.HandleException(e);
            }
        }
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            EditModelPermission.AlwaysGranted = System.Diagnostics.Debugger.IsAttached;
            SecuredExportExampleWindowsFormsApplication winApplication = new SecuredExportExampleWindowsFormsApplication();

#if EASYTEST
            DevExpress.ExpressApp.Win.EasyTest.EasyTestRemotingRegistration.Register();
#endif
            try {
                InMemoryDataStoreProvider.Register();
                winApplication.ConnectionString = InMemoryDataStoreProvider.ConnectionString;
                ((SecurityStrategy)winApplication.Security).CustomizeRequestProcessors +=
                    delegate(object sender, CustomizeRequestProcessorsEventArgs e) {
                    List <IOperationPermission> result   = new List <IOperationPermission>();
                    SecurityStrategyComplex     security = sender as SecurityStrategyComplex;
                    if (security != null)
                    {
                        Employee user = security.User as Employee;
                        if (user != null)
                        {
                            foreach (ExtendedSecurityRole role in user.Roles)
                            {
                                if (role.CanExport)
                                {
                                    result.Add(new ExportPermission());
                                }
                            }
                        }
                    }
                    IPermissionDictionary permissionDictionary = new PermissionDictionary((IEnumerable <IOperationPermission>)result);
                    e.Processors.Add(typeof(ExportPermissionRequest), new ExportPermissionRequestProcessor(permissionDictionary));
                };
                winApplication.Setup();
                winApplication.Start();
            }
            catch (Exception e) {
                winApplication.HandleException(e);
            }
        }
Exemple #11
0
        static void Main()
        {
#if EASYTEST
            DevExpress.ExpressApp.Win.EasyTest.EasyTestRemotingRegistration.Register();
#endif

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            EditModelPermission.AlwaysGranted = System.Diagnostics.Debugger.IsAttached;
            CustomFunctionCriteriaOperatorWindowsFormsApplication winApplication = new CustomFunctionCriteriaOperatorWindowsFormsApplication();
            InMemoryDataStoreProvider.Register();
            winApplication.ConnectionString = InMemoryDataStoreProvider.ConnectionString;
            try {
                // Uncomment this line when using the Middle Tier application server:
                // new DevExpress.ExpressApp.MiddleTier.MiddleTierClientApplicationConfigurator(winApplication);
                winApplication.Setup();
                winApplication.Start();
            }
            catch (Exception e) {
                winApplication.HandleException(e);
            }
        }
Exemple #12
0
        protected void Session_Start(Object sender, EventArgs e)
        {
            WebApplication.SetInstance(Session, new SecurityDemoAspNetApplication());
            WebApplication.Instance.CreateCustomLogonWindowObjectSpace += new EventHandler <CreateCustomLogonWindowObjectSpaceEventArgs>(Instance_CreateCustomLogonWindowObjectSpace);
            WebApplication.Instance.CreateCustomLogonWindowControllers += new EventHandler <CreateCustomLogonWindowControllersEventArgs>(Instance_CreateCustomLogonWindowControllers);


            if (ConfigurationManager.AppSettings["SiteMode"] != null && ConfigurationManager.AppSettings["SiteMode"].ToLower() == "true")
            {
                InMemoryDataStoreProvider.Register();
                WebApplication.Instance.ConnectionString = InMemoryDataStoreProvider.ConnectionString;
            }
            else
            {
                if (ConfigurationManager.ConnectionStrings["ConnectionString"] != null)
                {
                    WebApplication.Instance.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
                }
            }

            WebApplication.Instance.Setup();
            WebApplication.Instance.Start();
        }
Exemple #13
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            EditModelPermission.AlwaysGranted = System.Diagnostics.Debugger.IsAttached;
            WinSolutionWindowsFormsApplication app = new WinSolutionWindowsFormsApplication();

            InMemoryDataStoreProvider.Register();
            app.ConnectionString = InMemoryDataStoreProvider.ConnectionString;
            if (ConfigurationManager.ConnectionStrings["ConnectionString"] != null)
            {
                app.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
            }
            try {
                DevExpress.ExpressApp.Xpo.InMemoryDataStoreProvider.Register();
                app.ConnectionString = DevExpress.ExpressApp.Xpo.InMemoryDataStoreProvider.ConnectionString;
                app.Setup();
                app.Start();
            }
            catch (Exception e) {
                app.HandleException(e);
            }
        }
Exemple #14
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);


            InMemoryDataStoreProvider.Register();

            var application = new T360991WinApplication
            {
                ConnectionString = InMemoryDataStoreProvider.ConnectionString
            };

            application.CreateCustomObjectSpaceProvider += (sender, args) =>
            {
                args.ObjectSpaceProvider = new XPObjectSpaceProvider(new ConnectionStringDataStoreProvider(args.ConnectionString));
            };

            application.DatabaseVersionMismatch += (sender, args) =>
            {
                args.Updater.Update();
                args.Handled = true;
            };


            try
            {
                application.Setup();

                application.Start();
            }
            catch (Exception e)
            {
                application.HandleException(e);
            }
        }
Exemple #15
0
 public DXExampleModule()
 {
     InMemoryDataStoreProvider.Register();
     InitializeComponent();
 }
        static void Main(string[] args)
        {
            try {
                ValueManager.ValueManagerType = typeof(MultiThreadValueManager <>).GetGenericTypeDefinition();
                InMemoryDataStoreProvider.Register();
                string connectionString = InMemoryDataStoreProvider.ConnectionString;

                Console.WriteLine("Starting...");

                ServerApplication serverApplication = new ServerApplication();
                // Change the ServerApplication.ApplicationName property value. It should be the same as your client application name.
                serverApplication.ApplicationName = "SecuredExportExample";

                // Add your client application's modules to the ServerApplication.Modules collection here.
                serverApplication.Modules.BeginInit();
                serverApplication.Modules.Add(new DevExpress.ExpressApp.Win.SystemModule.SystemWindowsFormsModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.Security.SecurityModule());
                serverApplication.Modules.Add(new SecuredExportExample.Module.SecuredExportExampleModule());
                serverApplication.Modules.EndInit();

                serverApplication.DatabaseVersionMismatch         += new EventHandler <DatabaseVersionMismatchEventArgs>(serverApplication_DatabaseVersionMismatch);
                serverApplication.CreateCustomObjectSpaceProvider += new EventHandler <CreateCustomObjectSpaceProviderEventArgs>(serverApplication_CreateCustomObjectSpaceProvider);

                serverApplication.ConnectionString = connectionString;

                Console.WriteLine("Setup...");
                serverApplication.Setup();
                Console.WriteLine("CheckCompatibility...");
                serverApplication.CheckCompatibility();
                serverApplication.Dispose();

                Console.WriteLine("Starting server...");
                Func <IDataServerSecurity> dataServerSecurityProvider = () => {
                    SecurityStrategyComplex security = new SecurityStrategyComplex(
                        typeof(Employee), typeof(ExtendedSecurityRole), new AuthenticationStandard());
                    security.CustomizeRequestProcessors +=
                        delegate(object sender, CustomizeRequestProcessorsEventArgs e) {
                        List <IOperationPermission> result = new List <IOperationPermission>();
                        if (security != null)
                        {
                            Employee user = security.User as Employee;
                            if (user != null)
                            {
                                foreach (ExtendedSecurityRole role in user.Roles)
                                {
                                    if (role.CanExport)
                                    {
                                        result.Add(new ExportPermission());
                                    }
                                }
                            }
                        }
                        IPermissionDictionary permissionDictionary = new PermissionDictionary((IEnumerable <IOperationPermission>)result);
                        e.Processors.Add(typeof(ExportPermissionRequest), new ExportPermissionRequestProcessor(permissionDictionary));
                    };
                    return(security);
                };

                WcfDataServerHelper.AddKnownType(typeof(ExportPermissionRequest));
                WcfXafServiceHost serviceHost = new WcfXafServiceHost(connectionString, dataServerSecurityProvider);
                serviceHost.AddServiceEndpoint(typeof(IWcfXafDataServer), WcfDataServerHelper.CreateNetTcpBinding(), "net.tcp://127.0.0.1:1451/DataServer");
                serviceHost.Open();
                Console.WriteLine("Server is started. Press Enter to stop.");
#if !EASYTEST
                Console.ReadLine();
#else
                // 20 seconds is enough to pass all tests:
                System.Threading.Thread.Sleep(20000);
#endif
                Console.WriteLine("Stopping...");
                serviceHost.Close();
                Console.WriteLine("Server is stopped.");
            }
            catch (Exception e) {
                Console.WriteLine("Exception occurs: " + e.Message);
                Console.WriteLine("Press Enter to close.");
                Console.ReadLine();
            }
        }