Пример #1
0
 public static void SetConnectionString(DependencyObject dp, ConnectionString value)
 {
     dp.SetValue(ConnectionStringProperty, value);
 }
Пример #2
0
        /// <summary>
        /// Initializes the database connection.
        /// </summary>
        private void InitializeDBConnection()
        {
            if ( App.ExistingConnection != null )
            {
                CurrentConnection = App.ExistingConnection;
            }
            else
            {
                //initialize from app.config
                var appConfig = ConfigurationManager.OpenExeConfiguration( ConfigurationUserLevel.None );
                var rockConnectionString = appConfig.ConnectionStrings.ConnectionStrings["RockContext"];

                if ( rockConnectionString != null )
                {
                    CurrentConnection = new ConnectionString( rockConnectionString.ConnectionString );
                }
            }
        }