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


C# IAggregateRoot类代码示例

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


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

示例1: PersistUpdateOf

        public void PersistUpdateOf(IAggregateRoot entity)
        {
            Account account = entity as Account;

            string sql = "UPDATE Account SET [email protected] WHERE [email protected]";
            SqlParameter parameter1 = new SqlParameter("@Id", account.Id);
            SqlParameter parameter2= new SqlParameter("@Balance", account.Balance);

            using (SqlConnection conn = new SqlConnection(_connStr))
            {
                conn.Open();
                using (SqlCommand cmd = conn.CreateCommand())
                {
                    cmd.CommandText = sql;
                    cmd.Parameters.Add(parameter1);
                    cmd.Parameters.Add(parameter2);

                    int affectedCount = cmd.ExecuteNonQuery();

                    if (affectedCount <= 0) 
                    {
                        throw new Exception("update Account failed");
                    }
                }
            }
        }
开发者ID:NDChen,项目名称:MyDemoCode,代码行数:26,代码来源:AccountRepository.cs

示例2: RegisterUpdate

		public void RegisterUpdate(IAggregateRoot aggregateRoot, IUnitOfWorkRepository repository)
		{
			if (!_updatedAggregates.ContainsKey(aggregateRoot))
			{
				_updatedAggregates.Add(aggregateRoot, repository);
			}
		}
开发者ID:hanson-huang,项目名称:DDDSkeletonNet,代码行数:7,代码来源:InMemoryUnitOfWork.cs

示例3: UserSnapshot

		public UserSnapshot(IAggregateRoot root, string name, int age)
		{
			Id = root.Id;
			Version = root.Version;
			Name = name;
			Age = age;
		}
开发者ID:Kostassoid,项目名称:Nerve.EventStore,代码行数:7,代码来源:UserSnapshot.cs

示例4: RegisterNew

 public void RegisterNew(IAggregateRoot entity, IUnitOfWorkRepository unitOfWorkRepository)
 {
     if (!addedEntities.ContainsKey(entity))
     {
         addedEntities.Add(entity, unitOfWorkRepository);
     }
 }
开发者ID:xiaoyaopan,项目名称:Enterprise-Pattern,代码行数:7,代码来源:UnitOfWork.cs

示例5: RegisterRemoved

 public void RegisterRemoved(IAggregateRoot entity, IUnitOfWorkRepository unitOfWorkRepository)
 {
     if (!deletedEntities.ContainsKey(entity))
     {
         deletedEntities.Add(entity, unitOfWorkRepository);
     }
 }
开发者ID:xiaoyaopan,项目名称:Enterprise-Pattern,代码行数:7,代码来源:UnitOfWork.cs

示例6: Add

 public void Add(IAggregateRoot entity, IUnitOfWorkRepository uowRepository)
 {
     if (!_addedEntities.ContainsKey(entity))
     {
         _addedEntities.Add(entity, uowRepository);
     }
 }
开发者ID:winsaludar,项目名称:Base,代码行数:7,代码来源:UnitOfWork.cs

示例7: RegisterAmended

 public void RegisterAmended(IAggregateRoot objectEntity, IUnitOfWorkRepository unitOfWorkRepository)
 {
     if (!changedEntities.ContainsKey(objectEntity))
     {
         changedEntities.Add(objectEntity, unitOfWorkRepository);
     }
 }
开发者ID:uczenn,项目名称:VoteProject,代码行数:7,代码来源:UnitOfWork.cs

示例8: RegisterRemoved

 public void RegisterRemoved(IAggregateRoot objectEntity, IUnitOfWorkRepository unitOfWorkRepository)
 {
     if (!removedEntities.ContainsKey(objectEntity))
     {
         removedEntities.Add(objectEntity, unitOfWorkRepository);
     }
 }
开发者ID:uczenn,项目名称:VoteProject,代码行数:7,代码来源:UnitOfWork.cs

示例9: AggregateChangedEventArgs

        /// <summary>
        /// Initializes a new instance of the <see cref="AggregateChangedEventArgs"/> class.
        /// </summary>
        /// <param name="aggregateRoot">The aggregate root.</param>
        /// <param name="entity">The entity.</param>
        /// <param name="propertyName">Name of the property.</param>
        /// <param name="oldValue">The old value.</param>
        /// <param name="newValue">The new value.</param>
        public AggregateChangedEventArgs(
            IAggregateRoot aggregateRoot,
            IEntity entity,
            string propertyName,
            object oldValue,
            object newValue )
        {
            if ( aggregateRoot == null )
            {
                throw new ArgumentNullException ( "aggregateRoot" );
            }

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

            if ( string.IsNullOrWhiteSpace ( propertyName ) )
            {
                throw new ArgumentNullException ( "propertyName" );
            }

            AggregateChangedType = AggregateChangedType.PropertyValueChanged;
            AggregateRoot = aggregateRoot;
            SourceEntity = entity;
            PropertyName = propertyName;
            OldValue = oldValue;
            NewValue = newValue;
        }
开发者ID:divyang4481,项目名称:REM,代码行数:37,代码来源:AggregateChangedEventArgs.cs

示例10: Add

 public void Add(IAggregateRoot aggregateRoot)
 {
     if (!_aggregateRoots.ContainsKey(aggregateRoot.AggregateRootId))
     {
         _aggregateRoots.TryAdd(aggregateRoot.AggregateRootId, aggregateRoot);
     }
 }
开发者ID:liuxiqin,项目名称:Sevens,代码行数:7,代码来源:AggregateRootMemoryCache.cs

示例11: RegisterDeletion

		public void RegisterDeletion(IAggregateRoot aggregateRoot, IUnitOfWorkRepository repository)
		{
			if (!_deletedAggregates.ContainsKey(aggregateRoot))
			{
				_deletedAggregates.Add(aggregateRoot, repository);
			}
		}
开发者ID:hanson-huang,项目名称:DDDSkeletonNet,代码行数:7,代码来源:InMemoryUnitOfWork.cs

示例12: Handle

		public void Handle(IAggregateRoot root, IDomainEvent ev)
		{
			MethodInvoker invoker;
			if (!_handlers.TryGetValue(ev.GetType(), out invoker))
			{
				throw new InvalidOperationException(string.Format("Apply method for event [{0}] wasn't resolved in [{1}]", ev.GetType().Name, root.GetType().Name));
			}

			invoker.Invoke(root, new object[] {ev});
		}
开发者ID:Kostassoid,项目名称:Nerve.EventStore,代码行数:10,代码来源:EventHandlerRegistry.cs

示例13: CreateMessage

 private DomainEventStreamMessage CreateMessage(IAggregateRoot aggregateRoot)
 {
     return new DomainEventStreamMessage(
         ObjectId.GenerateNewStringId(),
         aggregateRoot.UniqueId,
         aggregateRoot.Version + 1,
         aggregateRoot.GetType().FullName,
         aggregateRoot.GetChanges(),
         new Dictionary<string, string>());
 }
开发者ID:ulswww,项目名称:enode,代码行数:10,代码来源:EventSequenceTest.cs

示例14: RegisterNew

 public void RegisterNew(IAggregateRoot entity, IUnitOfWorkRepository repository)
 {
     List<IAggregateRoot> items = null;
     if (!add.TryGetValue(repository, out items))
     {
         items = new List<IAggregateRoot>();
         add.Add(repository, items);
     }
     items.Add(entity);
 }
开发者ID:afrancocode,项目名称:ConcurrencyPatterns,代码行数:10,代码来源:UnitOfWork.cs

示例15: BuildEventStream

 private EventStreamRecord BuildEventStream(IAggregateRoot aggregateRoot, string commandId)
 {
     return new EventStreamRecord()
     {
         AggregateRootId = aggregateRoot.AggregateRootId,
         CommandId = commandId,
         Version = aggregateRoot.Version,
         EventDatas = _binarySerializer.Serialize(aggregateRoot.GetUnCommitEvents())
     };
 }
开发者ID:liuxiqin,项目名称:Sevens,代码行数:10,代码来源:DefaultCommandProssor.cs


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