当前位置: 首页>>代码示例>>C#>>正文


C# IMemento类代码示例

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


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


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