Exemple #1
0
    protected IDevAVDbUnitOfWork GetUow()
    {
        var connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["DevAVConnectionString"].ConnectionString;

        connectionString = DbEngineDetector.PatchConnectionString(connectionString); // TO use LocalDB or SQLExpress
        return(new DevAVDbUnitOfWork(new DevAVDb(connectionString)));                // return MOC object that can return model objects
    }
        public MainDemoMobileApplication()
        {
            SecurityAdapterHelper.Enable();
            if (MainDemoModule.IsSiteMode)
            {
                ConnectionString = ConfigurationManager.ConnectionStrings["MainDemoMobileConnectionString"].ConnectionString;
            }
            else
            {
                if (ConfigurationManager.ConnectionStrings["ConnectionString"] != null)
                {
                    ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
                }
                else if (string.IsNullOrEmpty(ConnectionString) && Connection == null)
                {
                    var connectionStringSettings = ConfigurationManager.ConnectionStrings["SqlExpressConnectionString"];
                    if (connectionStringSettings != null)
                    {
                        ConnectionString = DbEngineDetector.PatchConnectionString(connectionStringSettings.ConnectionString);
                    }
                }
            }

            InitializeComponent();
            InitializeDefaults();

            if (System.Diagnostics.Debugger.IsAttached && CheckCompatibilityType == CheckCompatibilityType.DatabaseSchema)
            {
                DatabaseUpdateMode = DatabaseUpdateMode.UpdateDatabaseAlways;
            }
            ShowAllNavigationGroupsAsFlatList = true;
        }
Exemple #3
0
        protected void Session_Start(Object sender, EventArgs e)
        {
            WebApplication.SetInstance(Session, new EFDemoWebApplication());
            AuditTrailService.Instance.CustomizeAuditTrailSettings += new CustomizeAuditSettingsEventHandler(Instance_CustomizeAuditTrailSettings);
            AuditTrailService.Instance.QueryCurrentUserName        += new QueryCurrentUserNameEventHandler(Instance_QueryCurrentUserName);
            WebApplication webApplication = WebApplication.Instance;

            webApplication.LastLogonParametersReading += new EventHandler <LastLogonParametersReadingEventArgs>(Instance_LastLogonParametersReading);
            webApplication.CustomizeFormattingCulture += new EventHandler <CustomizeFormattingCultureEventArgs>(Instance_CustomizeFormattingCulture);
            ConnectionStringSettings connectionStringSettings = ConfigurationManager.ConnectionStrings["ConnectionString"];

            if (connectionStringSettings != null)
            {
                webApplication.ConnectionString = connectionStringSettings.ConnectionString;
            }
            else if (string.IsNullOrEmpty(webApplication.ConnectionString) && webApplication.Connection == null)
            {
                connectionStringSettings = ConfigurationManager.ConnectionStrings["SqlExpressConnectionString"];
                if (connectionStringSettings != null)
                {
                    webApplication.ConnectionString = DbEngineDetector.PatchConnectionString(connectionStringSettings.ConnectionString);
                }
            }
            DevExpress.ExpressApp.ScriptRecorder.ScriptRecorderControllerBase.ScriptRecorderEnabled = true;

            webApplication.Setup();
            webApplication.Start();
        }
Exemple #4
0
        public static void Main(string[] arguments)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            EFDemoWinApplication winApplication = new EFDemoWinApplication();

#if DEBUG
            EasyTestRemotingRegistration.Register();
#endif
            winApplication.CustomizeFormattingCulture += new EventHandler <CustomizeFormattingCultureEventArgs>(winApplication_CustomizeFormattingCulture);
            winApplication.LastLogonParametersReading += new EventHandler <LastLogonParametersReadingEventArgs>(winApplication_LastLogonParametersReading);
            ConnectionStringSettings connectionStringSettings = ConfigurationManager.ConnectionStrings["ConnectionString"];
            if (connectionStringSettings != null)
            {
                winApplication.ConnectionString = connectionStringSettings.ConnectionString;
            }
            else if (string.IsNullOrEmpty(winApplication.ConnectionString) && winApplication.Connection == null)
            {
                connectionStringSettings = ConfigurationManager.ConnectionStrings["SqlExpressConnectionString"];
                if (connectionStringSettings != null)
                {
                    winApplication.ConnectionString = DbEngineDetector.PatchConnectionString(connectionStringSettings.ConnectionString);
                }
            }
            try {
                winApplication.Setup();
                winApplication.Start();
            }
            catch (Exception e) {
                winApplication.HandleException(e);
            }
        }
        private String GetConnectionString()
        {
            String result   = null;
            String siteMode = ConfigurationManager.AppSettings["SiteMode"];

            if (siteMode != null && siteMode.ToLower() == "true")
            {
                ConnectionString = InMemoryDataStoreProvider.ConnectionString;
            }
            else
            {
                ConnectionStringSettings connectionStringSettings = ConfigurationManager.ConnectionStrings["ConnectionString"];
                if (connectionStringSettings != null)
                {
                    result = connectionStringSettings.ConnectionString;
                }
                else
                {
                    connectionStringSettings = ConfigurationManager.ConnectionStrings["SqlExpressConnectionString"];
                    if (connectionStringSettings != null)
                    {
                        result = DbEngineDetector.PatchConnectionString(connectionStringSettings.ConnectionString);
                    }
                }
            }

            return(result);
        }
Exemple #6
0
        public MainDemoMobileApplication()
        {
            InitAdditionalPhoneGapPlugins();
            SecurityAdapterHelper.Enable();
            string siteMode = ConfigurationManager.AppSettings["SiteMode"];

            if (siteMode != null && siteMode.ToLower() == "true")
            {
                ConnectionString = ConfigurationManager.ConnectionStrings["MainDemoMobileConnectionString"].ConnectionString;
            }
            else
            {
                if (ConfigurationManager.ConnectionStrings["ConnectionString"] != null)
                {
                    ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
                }
                else if (string.IsNullOrEmpty(ConnectionString) && Connection == null)
                {
                    var connectionStringSettings = ConfigurationManager.ConnectionStrings["SqlExpressConnectionString"];
                    if (connectionStringSettings != null)
                    {
                        ConnectionString = DbEngineDetector.PatchConnectionString(connectionStringSettings.ConnectionString);
                    }
                }
            }
            if (System.Diagnostics.Debugger.IsAttached && CheckCompatibilityType == CheckCompatibilityType.DatabaseSchema)
            {
                DatabaseUpdateMode = DatabaseUpdateMode.UpdateDatabaseAlways;
            }
            InitializeComponent();
        }
        public static void Main(string[] arguments)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            Tracing.LocalUserAppDataPath = Application.LocalUserAppDataPath;
            Tracing.Initialize();
            MainDemoWinApplication winApplication = new MainDemoWinApplication
            {
                EnableModelCache = true,
                LinkNewObjectToParentImmediately = false,
                UseLightStyle = true
            };

#if DEBUG
            DevExpress.ExpressApp.Win.EasyTest.EasyTestRemotingRegistration.Register();
#endif
            AuditTrailService.Instance.QueryCurrentUserName += new QueryCurrentUserNameEventHandler(Instance_QueryCurrentUserName);
            winApplication.CustomizeFormattingCulture       += new EventHandler <CustomizeFormattingCultureEventArgs>(winApplication_CustomizeFormattingCulture);
            winApplication.LastLogonParametersReading       += new EventHandler <LastLogonParametersReadingEventArgs>(winApplication_LastLogonParametersReading);
            winApplication.CreateCustomObjectSpaceProvider  += (sender, e) => {
                e.ObjectSpaceProviders.Add(new SecuredObjectSpaceProvider((ISelectDataSecurityProvider)winApplication.Security, e.ConnectionString, e.Connection, false));
                e.ObjectSpaceProviders.Add(new NonPersistentObjectSpaceProvider(winApplication.TypesInfo, null));
            };
            ////winApplication.UseOldTemplates = true;
            ConnectionStringSettings connectionStringSettings = ConfigurationManager.ConnectionStrings["ConnectionString"];
            if (connectionStringSettings != null)
            {
                winApplication.ConnectionString = connectionStringSettings.ConnectionString;
            }
            else if (string.IsNullOrEmpty(winApplication.ConnectionString) && winApplication.Connection == null)
            {
                connectionStringSettings = ConfigurationManager.ConnectionStrings["SqlExpressConnectionString"];
                if (connectionStringSettings != null)
                {
                    winApplication.ConnectionString = DbEngineDetector.PatchConnectionString(connectionStringSettings.ConnectionString);
                }
            }
#if DEBUG
            foreach (string argument in arguments)
            {
                if (argument.StartsWith("-connectionString:"))
                {
                    string connectionString = argument.Replace("-connectionString:", "");
                    winApplication.ConnectionString = connectionString;
                }
            }
#endif
            if (System.Diagnostics.Debugger.IsAttached && winApplication.CheckCompatibilityType == CheckCompatibilityType.DatabaseSchema)
            {
                winApplication.DatabaseUpdateMode = DatabaseUpdateMode.UpdateDatabaseAlways;
            }
            try {
                winApplication.Setup();
                winApplication.Start();
            }
            catch (Exception e) {
                winApplication.HandleException(e);
            }
        }
        private void SetConnectionString(WebApplication webApplication)
        {
            string siteMode = ConfigurationManager.AppSettings["SiteMode"];

            if (siteMode != null && siteMode.ToLower() == "true")
            {
                webApplication.ConnectionString = InMemoryDataStoreProvider.ConnectionString;
            }
            else
            {
                ConnectionStringSettings connectionStringSettings = ConfigurationManager.ConnectionStrings["ConnectionString"];
                if (connectionStringSettings != null)
                {
                    webApplication.ConnectionString = connectionStringSettings.ConnectionString;
                }
                else if (string.IsNullOrEmpty(webApplication.ConnectionString) && webApplication.Connection == null)
                {
                    connectionStringSettings = ConfigurationManager.ConnectionStrings["SqlExpressConnectionString"];
                    if (connectionStringSettings != null)
                    {
                        webApplication.ConnectionString = DbEngineDetector.PatchConnectionString(connectionStringSettings.ConnectionString);
                    }
                }
            }
        }
Exemple #9
0
 protected override void OnStartup(StartupEventArgs e)
 {
     base.OnStartup(e);
     ApplicationThemeHelper.UpdateApplicationThemeName();
     DbEngineDetector.PatchConnectionStringsAndConfigureEntityFrameworkDefaultConnectionFactory();
     Database.SetInitializer <DepartmentContext>(new DepartmentContextInitializer());
 }
 protected override void OnStartup(StartupEventArgs e)
 {
     base.OnStartup(e);
     ApplicationThemeHelper.UpdateApplicationThemeName();
     DbEngineDetector.PatchConnectionStringsAndConfigureEntityFrameworkDefaultConnectionFactory();
     Database.SetInitializer <SchoolContext>(new SchoolContextInitializer());
     MetadataLocator.Default = MetadataLocator.Create().AddMetadata <SchoolContextMetadata>();
 }
Exemple #11
0
        public void Init()
        {
            RaiseProgress("Loading Photos...");
            string dbPath           = Path.Combine(Environment.CurrentDirectory, @"..\..\Data\Generator\DevAV_source.mdf");
            string connectionString = DbEngineDetector.PatchConnectionString(string.Format("data source=(localdb)\\mssqllocaldb;Integrated Security=true;database=DevAV_source;AttachDbFileName={0}", dbPath));

            sqlConnection = new SqlConnection(connectionString);
            sqlConnection.Open();
        }
Exemple #12
0
    static DevAVDb GetDataContext()
    {
        DevExpress.DemoData.DemoDbContext.IsWebModel = true;

        var connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["DevAVConnectionString"].ConnectionString;

        connectionString = DbEngineDetector.PatchConnectionString(connectionString);
        return(new DevAVDb(connectionString));
    }
Exemple #13
0
        static void Main(string[] arguments)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            WorkflowDemoEFWindowsFormsApplication xafApplication = new WorkflowDemoEFWindowsFormsApplication();

#if DEBUG
            DevExpress.ExpressApp.Win.EasyTest.EasyTestRemotingRegistration.Register();
#endif

            ConnectionStringSettings connectionStringSettings = ConfigurationManager.ConnectionStrings["ConnectionString"];
            if (connectionStringSettings != null)
            {
                xafApplication.ConnectionString = connectionStringSettings.ConnectionString;
            }
            else if (string.IsNullOrEmpty(xafApplication.ConnectionString) && xafApplication.Connection == null)
            {
                connectionStringSettings = ConfigurationManager.ConnectionStrings["SqlExpressConnectionString"];
                if (connectionStringSettings != null)
                {
                    xafApplication.ConnectionString = DbEngineDetector.PatchConnectionString(connectionStringSettings.ConnectionString);
                }
            }

            xafApplication.Modules.FindModule <WorkflowWindowsFormsModule>().QueryAvailableActivities += delegate(object sender, ActivitiesInformationEventArgs e) {
                e.ActivitiesInformation.Add(new ActivityInformation(typeof(CreateTask), "Code Activities", "Create Task", ImageLoader.Instance.GetImageInfo("CreateTask").Image));
            };

            WorkflowServerStarter starter = null;
            xafApplication.LoggedOn += delegate(object sender, LogonEventArgs e) {
                if (starter == null)
                {
                    starter = new WorkflowServerStarter();
                    starter.OnCustomHandleException += delegate(object sender1, ExceptionEventArgs args1) {
                        MessageBox.Show(args1.Message);
                    };

                    starter.Start(xafApplication.ConnectionString, xafApplication.ApplicationName);
                }
            };

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

            if (starter != null)
            {
                starter.Stop();
            }
        }
Exemple #14
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            DbEngineDetector.PatchConnectionStringsAndConfigureEntityFrameworkDefaultConnectionFactory();
            Database.SetInitializer(new DiagramStorageInitializer());

            Application.Run(new Form1());
        }
Exemple #15
0
        public static void Main(string[] arguments)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            if (Tracing.GetFileLocationFromSettings() == FileLocation.CurrentUserApplicationDataFolder)
            {
                Tracing.LocalUserAppDataPath = Application.LocalUserAppDataPath;
            }
            Tracing.Initialize();
            MainDemoWinApplication winApplication = new MainDemoWinApplication();

#if DEBUG
            DevExpress.ExpressApp.Win.EasyTest.EasyTestRemotingRegistration.Register();
#endif
            AuditTrailService.Instance.QueryCurrentUserName += new QueryCurrentUserNameEventHandler(Instance_QueryCurrentUserName);
            winApplication.CustomizeFormattingCulture       += new EventHandler <CustomizeFormattingCultureEventArgs>(winApplication_CustomizeFormattingCulture);
            winApplication.LastLogonParametersReading       += new EventHandler <LastLogonParametersReadingEventArgs>(winApplication_LastLogonParametersReading);
            SecurityAdapterHelper.Enable();
            ConnectionStringSettings connectionStringSettings = ConfigurationManager.ConnectionStrings["ConnectionString"];
            if (connectionStringSettings != null)
            {
                winApplication.ConnectionString = connectionStringSettings.ConnectionString;
            }
            else if (string.IsNullOrEmpty(winApplication.ConnectionString) && winApplication.Connection == null)
            {
                connectionStringSettings = ConfigurationManager.ConnectionStrings["SqlExpressConnectionString"];
                if (connectionStringSettings != null)
                {
                    winApplication.ConnectionString = DbEngineDetector.PatchConnectionString(connectionStringSettings.ConnectionString);
                }
            }
#if DEBUG
            foreach (string argument in arguments)
            {
                if (argument.StartsWith("-connectionString:"))
                {
                    string connectionString = argument.Replace("-connectionString:", "");
                    winApplication.ConnectionString = connectionString;
                }
            }
#endif
            if (System.Diagnostics.Debugger.IsAttached && winApplication.CheckCompatibilityType == CheckCompatibilityType.DatabaseSchema)
            {
                winApplication.DatabaseUpdateMode = DatabaseUpdateMode.UpdateDatabaseAlways;
            }
            try {
                winApplication.Setup();
                winApplication.Start();
            }
            catch (Exception e) {
                winApplication.HandleException(e);
            }
        }
Exemple #16
0
        public static void Main(string[] arguments)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            if (Tracing.GetFileLocationFromSettings() == FileLocation.CurrentUserApplicationDataFolder)
            {
                Tracing.LocalUserAppDataPath = Application.LocalUserAppDataPath;
            }
            Tracing.Initialize();
#if DEBUG
#else
            DevExpress.ExpressApp.Utils.ImageLoader.Instance.UseSvgImages = true;
#endif
            XCRMWinApplication winApplication = new XCRMWinApplication();
#if EasyTest
            try {
                DevExpress.ExpressApp.Win.EasyTest.EasyTestRemotingRegistration.Register();
            }
            catch (Exception) { }
            DevExpress.XtraScheduler.Internal.Diagnostics.XtraSchedulerDebug.SkipInsertionCheck = true;
#endif
            winApplication.CustomizeFormattingCulture += new EventHandler <CustomizeFormattingCultureEventArgs>(winApplication_CustomizeFormattingCulture);
            SecurityAdapterHelper.Enable();
            try {
                ConnectionStringSettings connectionStringSettings = ConfigurationManager.ConnectionStrings["ConnectionString"];
                if (connectionStringSettings != null)
                {
                    winApplication.ConnectionString = connectionStringSettings.ConnectionString;
                }
                else
                {
                    connectionStringSettings = ConfigurationManager.ConnectionStrings["SqlExpressConnectionString"];
                    if (connectionStringSettings != null)
                    {
                        winApplication.ConnectionString = DbEngineDetector.PatchConnectionString(connectionStringSettings.ConnectionString);
                    }
                }

                if (System.Diagnostics.Debugger.IsAttached && winApplication.CheckCompatibilityType == CheckCompatibilityType.DatabaseSchema)
                {
                    winApplication.DatabaseUpdateMode = DatabaseUpdateMode.UpdateDatabaseAlways;
                }
                winApplication.Setup();
                winApplication.Start();
            }
            catch (Exception e) {
                winApplication.HandleException(e);
            }
        }
        public static string PatchSQLConnectionString(string connectionString)
        {
#if !NETSTANDARD
            if (DbEngineDetector.IsSqlExpressInstalled || DbEngineDetector.IsLocalDbInstalled)
            {
                return(DbEngineDetector.PatchConnectionString(connectionString));
            }
            else
            {
#endif
            return(DemoDbEngineDetectorHelper.AlternativeConnectionString);

#if !NETSTANDARD
        }
#endif
        }
            System.Configuration.ConnectionStringsSection CreateConnectionStringsSection()
            {
                var internalConnectionStringsSection = (System.Configuration.ConnectionStringsSection)internalConfigSystem.GetSection(ConnectionStringsSectionName);
                var connectionStringsSection         = new System.Configuration.ConnectionStringsSection();

                foreach (var connectionStringSettings in internalConnectionStringsSection.ConnectionStrings.Cast <System.Configuration.ConnectionStringSettings>())
                {
                    var patchedConnectionStringSettings = new System.Configuration.ConnectionStringSettings(
                        connectionStringSettings.Name,
                        DbEngineDetector.PatchConnectionString(connectionStringSettings.ConnectionString, connectionStringSettings.ProviderName == EntityFrameworkConnectionStringProviderName),
                        connectionStringSettings.ProviderName
                        );
                    connectionStringsSection.ConnectionStrings.Add(patchedConnectionStringSettings);
                }
                return(connectionStringsSection);
            }
Exemple #19
0
        private static void MainBody()
        {
#endif
            #endregion
            PasswordCryptographer.EnableRfc2898       = true;
            PasswordCryptographer.SupportLegacySha512 = false;

#if DEBUG
            DevExpress.ExpressApp.Win.EasyTest.EasyTestRemotingRegistration.Register();
#endif
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
#if !NETCOREAPP && !NETSTANDARD
            EditModelPermission.AlwaysGranted = System.Diagnostics.Debugger.IsAttached;
#endif
            Tracing.LocalUserAppDataPath = Application.LocalUserAppDataPath;
            Tracing.Initialize();
            ReportV2DemoWindowsFormsApplication winApplication           = new ReportV2DemoWindowsFormsApplication();
            ConnectionStringSettings            connectionStringSettings = ConfigurationManager.ConnectionStrings["ConnectionString"];
            if (connectionStringSettings != null)
            {
                winApplication.ConnectionString = connectionStringSettings.ConnectionString;
            }
            else if (string.IsNullOrEmpty(winApplication.ConnectionString) && winApplication.Connection == null)
            {
                connectionStringSettings = ConfigurationManager.ConnectionStrings["SqlExpressConnectionString"];
                if (connectionStringSettings != null)
                {
                    winApplication.ConnectionString = DbEngineDetector.PatchConnectionString(connectionStringSettings.ConnectionString);
                }
                #region DEMO_REMOVE
                winApplication.ConnectionString = DevExpress.ExpressApp.Xpo.InMemoryDataStoreProvider.ConnectionString;
                #endregion
            }
            if (System.Diagnostics.Debugger.IsAttached && winApplication.CheckCompatibilityType == CheckCompatibilityType.DatabaseSchema)
            {
                winApplication.DatabaseUpdateMode = DatabaseUpdateMode.UpdateDatabaseAlways;
            }
            try {
                winApplication.Setup();
                winApplication.Start();
            }
            catch (Exception e) {
                winApplication.HandleException(e);
            }
        }
        protected void Session_Start(object sender, EventArgs e)
        {
            Tracing.Initialize();

            WebApplication.SetInstance(Session, new XCRM.Web.XCRMWebApplication());
            WebApplication.Instance.SwitchToNewStyle();
            WebApplication.Instance.Settings.DefaultVerticalTemplateContentPath = "CustomDefaultVerticalTemplateContent.ascx";
            WebApplication.Instance.CustomizeFormattingCulture += new EventHandler <CustomizeFormattingCultureEventArgs>(webApplication_CustomizeFormattingCulture);
            SecurityAdapterHelper.Enable();
            ConnectionStringSettings connectionStringSettings = ConfigurationManager.ConnectionStrings["ConnectionString"];

            if (connectionStringSettings != null)
            {
                WebApplication.Instance.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].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);
                }
            }
            if (ConfigurationManager.AppSettings["SiteMode"] != null && ConfigurationManager.AppSettings["SiteMode"].ToLower() == "true")
            {
                connectionStringSettings = ConfigurationManager.ConnectionStrings["XCRMSiteModeConnectionString"];
                if (connectionStringSettings != null)
                {
                    WebApplication.Instance.ConnectionString    = connectionStringSettings.ConnectionString;
                    WebApplication.Instance.ObjectSpaceCreated += (s, args) => {
                        args.ObjectSpace.Committing += ObjectSpace_Committing;
                        args.ObjectSpace.Disposed   += ObjectSpace_Disposed;
                    };
                }
                WebApplication.Instance.Modules.FindModule <Module.Web.XCRMAspNetModule>().SiteMode = true;
            }
            //if(System.Diagnostics.Debugger.IsAttached && WebApplication.Instance.CheckCompatibilityType == CheckCompatibilityType.DatabaseSchema) {
            WebApplication.Instance.DatabaseUpdateMode = DatabaseUpdateMode.UpdateDatabaseAlways;
            //}

            WebApplication.Instance.Setup();
            WebApplication.Instance.Start();
        }
Exemple #21
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));
        }
Exemple #22
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();
        }
        private String GetConnectionString()
        {
            String result = null;
            ConnectionStringSettings connectionStringSettings = ConfigurationManager.ConnectionStrings["ConnectionString"];

            if (connectionStringSettings != null)
            {
                result = connectionStringSettings.ConnectionString;
            }
            else
            {
                connectionStringSettings = ConfigurationManager.ConnectionStrings["SqlExpressConnectionString"];
                if (connectionStringSettings != null)
                {
                    result = DbEngineDetector.PatchConnectionString(connectionStringSettings.ConnectionString);
                }
            }

            return(result);
        }
        public SQLConnectionWindow(string demoString, ServerModeRecordsGeneratorProviderBase provider)
        {
            InitializeComponent();
            generatorProvider = provider ?? CreateDefaultProvider();
            tbServer.Text     = DbEngineDetector.GetSqlServerInstanceName();
            rbWindowsAuthentication.Checked   += new RoutedEventHandler(radioGroup1_SelectedIndexChanged);
            rbWindowsAuthentication.Unchecked += new RoutedEventHandler(radioGroup1_SelectedIndexChanged);
            cbDatabase.EditValueChanged       += new EditValueChangedEventHandler(cbDatabase_EditValueChanged);
            tbServer.EditValueChanged         += new EditValueChangedEventHandler(teServer_EditValueChanged);
            bGenerateDB.Click += new RoutedEventHandler(sbGenerateDB_Click);
            bAddRecords.Click += new RoutedEventHandler(sbAddRecords_Click);
            bExit.Click       += new RoutedEventHandler(sbExit_Click);
            UpdateAuthenticationFields();
            UpdateGenerateDBButton();
            UpdateDatabaseTextEdit();

            cbDatabase.Text     = defaultDB;
            bAddRecords.Content = (string)bAddRecords.Content + demoString;
            bGenerateDB.Content = (string)bGenerateDB.Content + demoString;
            bExit.Content       = (string)bExit.Content + demoString;
            ShowParameters();
        }
Exemple #25
0
 private void SetConnectionString(WebApplication webApplication)
 {
     if (MainDemoModule.IsSiteMode)
     {
         webApplication.ConnectionString = InMemoryDataStoreProvider.ConnectionString;
     }
     else
     {
         ConnectionStringSettings connectionStringSettings = ConfigurationManager.ConnectionStrings["ConnectionString"];
         if (connectionStringSettings != null)
         {
             webApplication.ConnectionString = connectionStringSettings.ConnectionString;
         }
         else if (string.IsNullOrEmpty(webApplication.ConnectionString) && webApplication.Connection == null)
         {
             connectionStringSettings = ConfigurationManager.ConnectionStrings["SqlExpressConnectionString"];
             if (connectionStringSettings != null)
             {
                 webApplication.ConnectionString = DbEngineDetector.PatchConnectionString(connectionStringSettings.ConnectionString);
             }
         }
     }
 }
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);
            ApplicationThemeHelper.UpdateApplicationThemeName();
            DbEngineDetector.PatchConnectionStringsAndConfigureEntityFrameworkDefaultConnectionFactory();

            //var deleteContext = new DevAVDb();
            //if(deleteContext.Database.Exists())
            //    deleteContext.Database.Delete();

            var context = new DevAVDb();

            if (!context.Database.Exists())
            {
                DXSplashScreen.Show <GenerateDBSplashScreen>();
                DXSplashScreen.SetState("Generating database...");
                try {
                    Database.SetInitializer <DevAVDb>(new DatabaseInitializer());
                    context.Customers.Count();
                } finally {
                    DXSplashScreen.Close();
                }
            }
        }
Exemple #27
0
 private void Application_Startup(object sender, StartupEventArgs e)
 {
     ApplicationThemeHelper.UpdateApplicationThemeName();
     DbEngineDetector.PatchConnectionStringsAndConfigureEntityFrameworkDefaultConnectionFactory();
 }
 private void Application_Startup(object sender, StartupEventArgs e)
 {
     ApplicationThemeHelper.UpdateApplicationThemeName();
     DbEngineDetector.PatchConnectionStringsAndConfigureEntityFrameworkDefaultConnectionFactory();
     Database.SetInitializer <DepartmentContext>(new DepartmentContextInitializer());
 }
Exemple #29
0
 private void OnAppStartup_UpdateThemeName(object sender, StartupEventArgs e)
 {
     DevExpress.Xpf.Core.ApplicationThemeHelper.UpdateApplicationThemeName();
     DbEngineDetector.PatchConnectionStringsAndConfigureEntityFrameworkDefaultConnectionFactory();
     Database.SetInitializer(new DiagramStorageInitializer());
 }
 protected override void OnStartup(StartupEventArgs e)
 {
     DbEngineDetector.PatchConnectionStringsAndConfigureEntityFrameworkDefaultConnectionFactory();
     Database.SetInitializer <SchedulingContext>(new SchedulingContextInitializer());
     base.OnStartup(e);
 }