public virtual BaseAction Clone() { var baseAction = (BaseAction)Activator.CreateInstance(GetType(), Name); baseAction.ActionContainer = ActionContainer; baseAction.ActionInParameterManager = ActionInParameterManager.Clone(); baseAction.ActionOutParameterManager = ActionOutParameterManager.Clone(); return(baseAction); }
public void Test_Clone() { _clause.Join("b"); _clause.On("a.A", "c"); //复制副本 var copy = _clause.Clone(null, null, _parameterManager.Clone()); Assert.Equal("Join [b] On [a].[A]=@_p_0", GetSql()); Assert.Equal("Join [b] On [a].[A]=@_p_0", copy.ToSql()); //修改副本 copy.On("a.C", "d"); Assert.Equal("Join [b] On [a].[A]=@_p_0", GetSql()); Assert.Equal("Join [b] On [a].[A]=@_p_0 And [a].[C]=@_p_1", copy.ToSql()); }
public void TestClone() { _clause.Where("Name", "a"); //复制副本 var copy = _clause.Clone(null, null, _parameterManager.Clone()); Assert.Equal("Where [Name]=@_p_0", GetSql()); Assert.Equal("Where [Name]=@_p_0", copy.ToSql()); //修改副本 copy.Where("Code", 1); Assert.Equal("Where [Name]=@_p_0", GetSql()); Assert.Equal("Where [Name]=@_p_0 And [Code]=@_p_1", copy.ToSql()); //修改原对象 _clause.Where("Age", 1); Assert.Equal("Where [Name]=@_p_0 And [Age]=@_p_1", GetSql()); Assert.Equal("Where [Name]=@_p_0 And [Code]=@_p_1", copy.ToSql()); }
/// <summary> /// コンストラクタ /// </summary> /// <param name="mainWindow">呼び出し元IMaionWindowインスタンス</param> public NewStage(IMainWindow mainWindow) : base(mainWindow) { InitializeComponent(); this.window = mainWindow; this.parameterManager = window.ParameterManager; this.parameterBuffer = parameterManager.Clone(); this.overIndexTextBox.Text = String.Format("{0:0.000}", Properties.Settings.Default.IndexUp); this.underIndexTextBox.Text = String.Format("{0:0.000}", Properties.Settings.Default.IndexDown); this.overIndexTextBox.GotKeyboardFocus += overIndexTextBox_GotKeyboardFocus; this.overIndexTextBox.PreviewMouseLeftButtonDown += overIndexTextBox_MouseLeftButtonDown; this.underIndexTextBox.GotKeyboardFocus += underIndexTextBox_GotKeyboardFocus; this.underIndexTextBox.PreviewMouseLeftButtonDown += underIndexTextBox_MouseLeftButtonDown; this.dateTimer = new DispatcherTimer(DispatcherPriority.Normal); this.dateTimer.Interval = new TimeSpan(0, 0, 1); this.dateTimer.Tick += new EventHandler(dateTimer_Tick); this.dateTimer.Start(); this.nameTextBox.Text = parameterManager.UserName; this.mailTextBox.Text = parameterManager.MailAddress; }