• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IMemento类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IMemento的典型用法代码示例。如果您正苦于以下问题:C# IMemento类的具体用法?C# IMemento怎么用?C# IMemento使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IMemento类属于命名空间,在下文中一共展示了IMemento类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Build

 public IAggregate Build(Type type, Guid id, IMemento snapshot)
 {
     //if (type == typeof(IMyInterface))
     //    return new MyAggregate();
     //else
         return Activator.CreateInstance(type) as IAggregate;
 }
开发者ID:arthis,项目名称:CommonDomain,代码行数:7,代码来源:AggregateFactory.cs


示例2:

 void IOrginator.SetMemento(IMemento memento)
 {
     var bankCardMemento = (BankCardMemento)memento;
     Id = bankCardMemento.Id;
     _accountId = bankCardMemento.AccountId;
     _disabled = bankCardMemento.Disabled;
 }
开发者ID:togakangaroo,项目名称:Fohjin,代码行数:7,代码来源:BankCard.cs


示例3: CommandContext

 /// <summary>
 /// Initializes a new instance of the CommandContext class.
 /// </summary>
 /// <param name="game">Command context's IGame.</param>
 /// <param name="scoreboard">Command context'sIScoreboard.</param>
 /// <param name="boardHistory">Command context's IMemento.</param>
 public CommandContext(IGame game, IScoreboard scoreboard, IMemento boardHistory)
 {
     this.Game = game;
     this.ScoreboardInfo = scoreboard;
     this.BoardHistory = boardHistory;
     this.Moves = 0;
 }
开发者ID:TeamGameFifteen2AtTelerikAcademy,项目名称:Game-Fifteen,代码行数:13,代码来源:CommandContext.cs


示例4: Build

		public IAggregate Build(Type type, Guid id, IMemento snapshot)
		{
			ConstructorInfo constructor = type.GetConstructor(
				BindingFlags.NonPublic | BindingFlags.Instance, null, new[] { typeof(Guid) }, null);

			return constructor.Invoke(new object[] { id }) as IAggregate;
		}
开发者ID:KoenWillemse,项目名称:NEventStore,代码行数:7,代码来源:IAggregatePersistenceTestHelpers.cs


示例5: Build

        public IAggregate Build(Type type, Guid id, IMemento snapshot)
        {
            var types = snapshot == null ? new[] { typeof(Guid) } : new[] { typeof(Guid), typeof(IMemento) };
            var args = snapshot == null ? new object[] { id } : new object[] { id, snapshot };

            ConstructorInfo constructor = type.GetConstructor(BindingFlags.NonPublic | BindingFlags.Instance, null, types, null);

            return constructor.Invoke(args) as IAggregate;
        }
开发者ID:raghur,项目名称:Eventstore.Utils,代码行数:9,代码来源:AggregateFactory.cs


示例6: SetMemento

        protected override void SetMemento(IMemento memento)
        {
            var productMemento = (ProductMemento)memento;

            Id = productMemento.Id;
            Version = productMemento.Version;
            Name = productMemento.Name;
            Price = new Money(productMemento.Price);
        }
开发者ID:petarkorudzhiev,项目名称:d3es,代码行数:9,代码来源:Product.cs


示例7: RestoreSnapshot

        void IAmRestorable.RestoreSnapshot(IMemento memento)
        {
            if (memento == null)
            {
                return;
            }

            RestoreSnapshot(memento);
        }
开发者ID:AdrianFreemantle,项目名称:clientele-training,代码行数:9,代码来源:EntityBase.cs


示例8: Redo

        /// <summary>
        /// Redo 操作を実行し、データを取得します。
        /// </summary>
        public IMemento Redo()
        {
            if (!canRedo) return null;

            undo.Push(Now);
            Now = redo.Pop();

            return Now.Clone();
        }
开发者ID:shotaATF,项目名称:OSCollections,代码行数:12,代码来源:UnReDoInvoker.cs


示例9: Merge

		public bool Merge(IMemento otherMemento) {
			TextChangeMemento other = otherMemento as TextChangeMemento;
			if (other != null) {
				if (other.textContainer.Equals(textContainer)) {
					// Match, do not store anything as the initial state is what we want.
					return true;
				}
			}
			return false;
		}
开发者ID:logtcn,项目名称:greenshot,代码行数:10,代码来源:TextChangeMemento.cs


示例10: Merge

		public bool Merge(IMemento otherMemento) {
			DrawableContainerBoundsChangeMemento other = otherMemento as DrawableContainerBoundsChangeMemento;
			if (other != null) {
				if (Objects.CompareLists<IDrawableContainer>(listOfdrawableContainer, other.listOfdrawableContainer)) {
					// Lists are equal, as we have the state already we can ignore the new memento
					return true;
				}
			}
			return false;
		}
开发者ID:logtcn,项目名称:greenshot,代码行数:10,代码来源:DrawableContainerBoundsChangeMemento.cs


示例11: RestoreSnapshot

        protected override void RestoreSnapshot(IMemento memento)
        {
            var portfolioMemento = (PortfolioMemento)memento;

            isOpen = portfolioMemento.IsOpen;

            foreach (var accountSnapshot in portfolioMemento.Accounts)
            {
                accounts.Add(RestoreEntity<Account>(accountSnapshot));
            }
        }
开发者ID:AdrianFreemantle,项目名称:clientele-training,代码行数:11,代码来源:Portfolio.State.cs


示例12: Merge

		public bool Merge(IMemento otherMemento) {
			ChangeFieldHolderMemento other = otherMemento as ChangeFieldHolderMemento;
			if (other != null) {
				if (other.drawableContainer.Equals(drawableContainer)) {
					if (other.fieldToBeChanged.Equals(fieldToBeChanged)) {
						// Match, do not store anything as the initial state is what we want.
						return true;
					}
				}
			}
			return false;
		}
开发者ID:logtcn,项目名称:greenshot,代码行数:12,代码来源:ChangeFieldHolderMemento.cs


示例13: Build

        public IAggregate Build(Type type, Guid id, IMemento snapshot)
        {
            ConstructorInfo constructor = type.GetConstructor(
                BindingFlags.NonPublic | BindingFlags.Instance, null, new Type[] {typeof (Guid)}, null);

            if (constructor == null)
            {
                throw new InvalidOperationException(
                    string.Format("Aggregate {0} cannot be created: constructor with only id parameter not provided",
                                  type.Name));
            }
            return constructor.Invoke(new object[] {id}) as IAggregate;
        }
开发者ID:rucka,项目名称:RealWorldCqrs,代码行数:13,代码来源:AggregateFactory.cs


示例14: MigrateSettings

		public static void MigrateSettings(bool createTargetCategoryAndFields,
		                                   bool migrateFieldValues,
		                                   IMemento newState,
		                                   IMemento oldState)
		{
			Migrator migrator = new Migrator();

			if (createTargetCategoryAndFields)
			{
				migrator.EnsureTargetCategory(newState.CategoryName);
				migrator.EnsureFields(newState.CategoryName, new MigrationInfo(oldState, newState).AllFields);
			}

			if (migrateFieldValues)
			{
				migrator.Migrate(new MigrationInfo(oldState, newState));
			}
		}
开发者ID:agross,项目名称:graffiti-usergroups,代码行数:18,代码来源:PluginMigrator.cs


示例15: MainForm

        public MainForm( )
        {
            _memento = ObjectFactory.GetInstance<IMemento>() ;

            _model = ObjectFactory.GetInstance<IModel>() ;

            InitializeComponent();

            _model.ActiveLayerChanged += activeLayerChanged ;
            _model.NewModelLoaded += newModelLoaded ;
            _model.OnBeforeUnloadingModel += modelUnloading ;

            _memento.OnCommandEnded += mementoCommandEnded ;
            _memento.OnCommandUndone += mementoCommandUndone;
            _memento.OnCommandRedone += mementoCommandRedone;

            uiAssetsControl.AssetChosenByDoubleClicking += assetChosenByDoubleClicking ;
        }
开发者ID:mtgattie,项目名称:Gleed2D,代码行数:18,代码来源:MainForm.cs


示例16: LevelExplorerControl

        public LevelExplorerControl( )
        {
            InteractsWithModel = true ;

            InitializeComponent( ) ;

            if( !Helper.IsInDesignMode )
            {
                var imageRepository = ObjectFactory.GetNamedInstance<IImageRepository>( @"iconImages" ) ;

                Assembly thisAssembly = Assembly.GetExecutingAssembly(  ) ;

                Images.SummonIcon( thisAssembly, LAYER_ICON_ACTIVE_NAME ) ;
                Images.SummonIcon( thisAssembly,LAYER_ICON_NONACTIVE_NAME ) ;
                Images.SummonIcon( thisAssembly,LEVEL_ICON_NAME ) ;

                _imageList = imageRepository.CreateImageList( ) ;

                _model = ObjectFactory.GetInstance<IModel>( ) ;
                _memento = ObjectFactory.GetInstance<IMemento>( ) ;

                subscribeToModelEvents( ) ;
            }

            uiTree.AllowDrop = true ;
            uiTree.CheckBoxes = true ;
            uiTree.FullRowSelect = true ;
            uiTree.HideSelection = false ;
            uiTree.HotTracking = true ;
            uiTree.ImageList = _imageList ;
            uiTree.LabelEdit = true ;
            uiTree.Name = "uiEntityTree" ;
            uiTree.ShowNodeToolTips = true ;

            uiTree.KeyDown += entityTreeKeyDown ;
            uiTree.MouseDown += entityTreeMouseDown ;
            uiTree.AfterLabelEdit += entityTreeAfterLabelEdit ;
            uiTree.AfterCheck += entityTreeAfterCheck ;
            uiTree.AfterSelect += entityTreeAfterSelect ;
            uiTree.DragDrop += entityTreeDragDrop ;
            uiTree.DragOver += entityTreeDragOver ;
            uiTree.ItemDrag += entityTreeItemDrag ;
        }
开发者ID:SteveDunn,项目名称:oglr,代码行数:43,代码来源:LevelExplorerControl.cs


示例17: ApplyMemento

 public void ApplyMemento(IMemento memento)
 {
     if (memento == null) throw new ArgumentNullException("memento");
     TextBoxMemento textBoxMemento;
     try
     {
         textBoxMemento = (TextBoxMemento) memento;
     }
     catch (InvalidCastException ex)
     {
         throw new IncompatibleMementoException(
             string.Format(
                 "Only memento of type [{0}] be applied to [{1}] ",
                 memento.GetType(),
                 GetType()),
             ex);
     }
     Text = textBoxMemento.Text;
     MoveCaretTo(textBoxMemento.CaretPostition);
     Select(textBoxMemento.Selection);
 }
开发者ID:KiemDuong,项目名称:Csharp-Design-Pattern,代码行数:21,代码来源:TextBox.cs


示例18: MigrationInfo

		public MigrationInfo(IMemento oldState, IMemento newState)
		{
			if (oldState == null)
			{
				throw new ArgumentNullException("oldState");
			}

			if (newState == null)
			{
				throw new ArgumentNullException("newState");
			}

			SourceCategoryName = oldState.CategoryName;
			TargetCategoryName = newState.CategoryName;

			ChangedFieldNames = MementoHelper.GetChangedFieldNames(oldState, newState);

			AllFields = new List<FieldInfo>();
			foreach (var newField in newState.Fields)
			{
				AllFields.Add(newField.Value);
			}
		}
开发者ID:agross,项目名称:graffiti-usergroups,代码行数:23,代码来源:MigrationInfo.cs


示例19: GetChangedFieldNames

		internal static Dictionary<string, string> GetChangedFieldNames(IMemento oldState, IMemento newState)
		{
			Dictionary<string, string> result = new Dictionary<string, string>();

			foreach (var oldField in oldState.Fields)
			{
				// Skip empty old field values.
				if (String.IsNullOrEmpty(oldField.Value.FieldName))
				{
					continue;
				}

				// Skip field names that did not change.
				if (String.Equals(oldField.Value.FieldName, newState.Fields[oldField.Key].FieldName))
				{
					continue;
				}

				result.Add(oldField.Value.FieldName, newState.Fields[oldField.Key].FieldName);
			}

			return result;
		}
开发者ID:agross,项目名称:graffiti-usergroups,代码行数:23,代码来源:MementoHelper.cs


示例20: SetMemento

 void IOrginator.SetMemento(IMemento memento)
 {
     SetMemento(memento);
 }
开发者ID:petarkorudzhiev,项目名称:d3es,代码行数:4,代码来源:AggregateRoot.cs



注:本文中的IMemento类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IMemory类代码示例发布时间:2022-05-24
下一篇:
C# IMembershipService类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap