/// <summary>
        /// Method which discards changes in Connection, and loads Connection state from database.
        /// </summary>
        /// <param name="connection">Connection which will be reverted.</param>
        public void Revert(SyncServerConnection connection)
        {
            if (connection == null) throw new ArgumentNullException("connection");
            if (connection.SyncServerConnectionId == Guid.Empty) return;

            Context.Refresh(RefreshMode.StoreWins, connection);
        }
        public SyncServerConnectionEditor(SyncServerConnection connection = null)
        {
            InitializeComponent();

            _syncServerConnection = connection ?? new SyncServerConnection();
            DataContext = new SyncServerConnectionEditorViewModel(new SmoTasks(), _syncServerConnection.ConnectionString)
                              {Connection = _syncServerConnection};
        }
Exemple #3
0
        /// <summary>
        /// Create a new SyncServerConnection object.
        /// </summary>
        /// <param name="syncServerConnectionId">Initial value of the SyncServerConnectionId property.</param>
        /// <param name="name">Initial value of the Name property.</param>
        /// <param name="connectionString">Initial value of the ConnectionString property.</param>
        public static SyncServerConnection CreateSyncServerConnection(global::System.Guid syncServerConnectionId, global::System.String name, global::System.String connectionString)
        {
            SyncServerConnection syncServerConnection = new SyncServerConnection();

            syncServerConnection.SyncServerConnectionId = syncServerConnectionId;
            syncServerConnection.Name             = name;
            syncServerConnection.ConnectionString = connectionString;
            return(syncServerConnection);
        }
        /// <summary>
        /// Deleting <see cref="SyncServerConnection"/> from database.
        /// </summary>
        /// <param name="connection"><see cref="SyncServerConnection"/> which will be deleted.</param>
        public void Delete(SyncServerConnection connection)
        {
            if (connection == null) throw new ArgumentNullException("connection");
            if (connection.SyncServerConnectionId == Guid.Empty ||
                Context.SyncServerConnections.Where(c => c.SyncServerConnectionId == connection.SyncServerConnectionId).
                    FirstOrDefault() == null) return;

            Context.DeleteObject(connection);
            Context.SaveChanges();
            refreshCache();
        }
        /// <summary>
        /// Methods for saving changes in database.
        /// </summary>
        /// <param name="connection">Connection which will be saved in database.</param>
        public void Save(SyncServerConnection connection)
        {
            if (connection == null) throw new ArgumentNullException("connection");
            if (connection.SyncServerConnectionId == Guid.Empty ||
                Context.SyncServerConnections.Where(c => c.SyncServerConnectionId == connection.SyncServerConnectionId).
                    FirstOrDefault() == null)
            {
                if (connection.SyncServerConnectionId == Guid.Empty)
                    connection.SyncServerConnectionId = Guid.NewGuid();

                Context.AddToSyncServerConnections(connection);
            }

            Context.SaveChanges();

            refreshCache();
        }
Exemple #6
0
 /// <summary>
 /// Deprecated Method for adding a new object to the SyncServerConnections EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToSyncServerConnections(SyncServerConnection syncServerConnection)
 {
     base.AddObject("SyncServerConnections", syncServerConnection);
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the SyncServerConnections EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToSyncServerConnections(SyncServerConnection syncServerConnection)
 {
     base.AddObject("SyncServerConnections", syncServerConnection);
 }
 /// <summary>
 /// Create a new SyncServerConnection object.
 /// </summary>
 /// <param name="syncServerConnectionId">Initial value of the SyncServerConnectionId property.</param>
 /// <param name="name">Initial value of the Name property.</param>
 /// <param name="connectionString">Initial value of the ConnectionString property.</param>
 public static SyncServerConnection CreateSyncServerConnection(global::System.Guid syncServerConnectionId, global::System.String name, global::System.String connectionString)
 {
     SyncServerConnection syncServerConnection = new SyncServerConnection();
     syncServerConnection.SyncServerConnectionId = syncServerConnectionId;
     syncServerConnection.Name = name;
     syncServerConnection.ConnectionString = connectionString;
     return syncServerConnection;
 }