本文整理汇总了C#中IUnitOfWorkRepository类的典型用法代码示例。如果您正苦于以下问题:C# IUnitOfWorkRepository类的具体用法?C# IUnitOfWorkRepository怎么用?C# IUnitOfWorkRepository使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IUnitOfWorkRepository类属于命名空间,在下文中一共展示了IUnitOfWorkRepository类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: RegistraRemovido
public void RegistraRemovido(IPersistenciaBase entidade, IUnitOfWorkRepository unitofWorkRepository)
{
if (!entidadesDeletadas.ContainsKey(entidade))
{
entidadesDeletadas.Add(entidade, unitofWorkRepository);
}
}
开发者ID:cvcs,项目名称:.Net_Testing,代码行数:7,代码来源:UnitOfWork.cs
示例2: RegisterAmended
public void RegisterAmended(IAggregateDataModel entity, IUnitOfWorkRepository unitofWorkRepository)
{
if (!changedEntities.ContainsKey(entity))
{
changedEntities.Add(entity, unitofWorkRepository);
}
}
开发者ID:elbandit,项目名称:PPPDDD,代码行数:7,代码来源:UnitOfWork.cs
示例3: RegisterDeletion
public void RegisterDeletion(IAggregateRoot aggregateRoot, IUnitOfWorkRepository repository)
{
if (!_deletedAggregates.ContainsKey(aggregateRoot))
{
_deletedAggregates.Add(aggregateRoot, repository);
}
}
开发者ID:hanson-huang,项目名称:DDDSkeletonNet,代码行数:7,代码来源:InMemoryUnitOfWork.cs
示例4: RegistraNovo
public void RegistraNovo(IPersistenciaBase entidade, IUnitOfWorkRepository unitofWorkRepository)
{
if (!entidadesAdicionadas.ContainsKey(entidade))
{
entidadesAdicionadas.Add(entidade, unitofWorkRepository);
}
}
开发者ID:cvcs,项目名称:.Net_Testing,代码行数: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: RegisterUpdate
public void RegisterUpdate(IAggregateRoot aggregateRoot, IUnitOfWorkRepository repository)
{
if (!_updatedAggregates.ContainsKey(aggregateRoot))
{
_updatedAggregates.Add(aggregateRoot, repository);
}
}
开发者ID:hanson-huang,项目名称:DDDSkeletonNet,代码行数:7,代码来源:InMemoryUnitOfWork.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: Add
public void Add(IAggregateRoot entity, IUnitOfWorkRepository uowRepository)
{
if (!_addedEntities.ContainsKey(entity))
{
_addedEntities.Add(entity, uowRepository);
}
}
开发者ID:winsaludar,项目名称:Base,代码行数:7,代码来源:UnitOfWork.cs
示例9: CreateFirstSeason
public Season CreateFirstSeason(Game game, List<Team> teams, IUnitOfWorkRepository repository)
{
// First check the number of teams can be evenly divided into the number of leagues.
bool teamsOk = teams.Count % Constants.HowManyLeagues == 0;
if (!teamsOk)
{
throw new Exception($"The number of teams must be divided by {Constants.HowManyLeagues}");
}
var newSeasonInfo = new NewSeasonInfo { Game = game, SeasonNumber = 0 };
// Divide all teams between the four leagues based on the team rating.
teams.Sort((team1, team2) => team2.Rating.CompareTo(team1.Rating));
int countTeamsPerLeague = teams.Count / Constants.HowManyLeagues;
newSeasonInfo.TeamsLeague1 = teams.Take(countTeamsPerLeague).ToList();
newSeasonInfo.TeamsLeague2 = teams.Skip(countTeamsPerLeague).Take(countTeamsPerLeague).ToList();
newSeasonInfo.TeamsLeague3 = teams.Skip(countTeamsPerLeague * 2).Take(countTeamsPerLeague).ToList();
newSeasonInfo.TeamsLeague4 = teams.Skip(countTeamsPerLeague * 3).ToList();
// The teams have been sorted on rating, so given them an initial league table position.
AssignInitialLeagueTablePosition(teams);
// In the first season there are no champion and cup winner yet, so pick the two best teams.
newSeasonInfo.NationalChampion = teams[0];
newSeasonInfo.NationalCupWinner = teams[1];
// Now all teams have been placed in the right leagues, so create match schedules for all competitions.
var seasonAndCompetitionSchedules = CreateSeasonAndCompetitionSchedules(newSeasonInfo);
// Insert the season and all competition schedules.
var season = InsertSeasonAndCompetitionSchedule(repository, seasonAndCompetitionSchedules);
return season;
}
开发者ID:bouwe77,项目名称:fmg,代码行数:34,代码来源:SeasonManager.cs
示例10: RegisterNew
public void RegisterNew(IAggregateRoot entity, IUnitOfWorkRepository unitOfWorkRepository)
{
if (!addedEntities.ContainsKey(entity))
{
addedEntities.Add(entity, unitOfWorkRepository);
}
}
开发者ID:xiaoyaopan,项目名称:Enterprise-Pattern,代码行数:7,代码来源:UnitOfWork.cs
示例11: RegisterRemoved
public void RegisterRemoved(IAggregateRoot objectEntity, IUnitOfWorkRepository unitOfWorkRepository)
{
if (!removedEntities.ContainsKey(objectEntity))
{
removedEntities.Add(objectEntity, unitOfWorkRepository);
}
}
开发者ID:uczenn,项目名称:VoteProject,代码行数:7,代码来源:UnitOfWork.cs
示例12: RegistroRemovido
public void RegistroRemovido(IRaizDeAgregacao entidade,
IUnitOfWorkRepository unitofWorkRepositorio)
{
if (!_entidadesDeletadas.ContainsKey(entidade))
{
_entidadesDeletadas.Add(entidade, unitofWorkRepositorio);
}
}
开发者ID:SyedArifulIslamEmon,项目名称:SystemsHealthManagement,代码行数:8,代码来源:UnitOfWork.cs
示例13: RegisterAdded
/// <summary>
/// Registers an <see cref="IEntity" /> instance to be added through this <see cref="Umbraco.Core.Persistence.UnitOfWork" />
/// </summary>
/// <param name="entity">The <see cref="IEntity" /></param>
/// <param name="repository">The <see cref="IUnitOfWorkRepository" /> participating in the transaction</param>
public void RegisterAdded(IEntity entity, IUnitOfWorkRepository repository)
{
_operations.Enqueue(new Operation
{
Entity = entity,
Repository = repository,
Type = TransactionType.Insert
});
}
开发者ID:ProNotion,项目名称:Merchello,代码行数:14,代码来源:PetaPocoUnitOfWork.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: RegisterRemoved
/// <summary>
/// Registers an <see cref="IEntity" /> instance to be removed through this <see cref="UnitOfWork" />
/// </summary>
/// <param name="entity">The <see cref="IEntity" /></param>
/// <param name="repository">The <see cref="IUnitOfWorkRepository" /> participating in the transaction</param>
public void RegisterRemoved(IEntity entity, IUnitOfWorkRepository repository)
{
_operations.Add(
new Operation
{
Entity = entity,
ProcessDate = DateTime.Now,
Repository = repository,
Type = TransactionType.Delete
});
}
开发者ID:phaniarveti,项目名称:Experiments,代码行数:16,代码来源:PetaPocoUnitOfWork.cs
示例16: RegisterDirty
public void RegisterDirty(IEntity entity, IUnitOfWorkRepository repository)
{
Debug.Assert(entity.Id != null, "id null");
if (removedEntities.ContainsKey(repository))
Debug.Assert(!removedEntities[repository].Contains(entity), "object removed");
if ((!dirtyEntities.ContainsKey(repository) || (dirtyEntities.ContainsKey(repository) && !dirtyEntities[repository].Contains(entity)))
&& (!newEntities.ContainsKey(repository) || (newEntities.ContainsKey(repository) && !newEntities[repository].Contains(entity))))
{
if (!dirtyEntities.ContainsKey(repository))
dirtyEntities.Add(repository, new List<IEntity>());
dirtyEntities[repository].Add(entity);
}
}
开发者ID:Kaike23,项目名称:PessimisticLock,代码行数:14,代码来源:UnitOfWork.cs
示例17: RegisterNew
public void RegisterNew(IEntity entity, IUnitOfWorkRepository repository)
{
Debug.Assert(entity != null);
if (dirtyEntities.ContainsKey(repository))
Debug.Assert(!dirtyEntities[repository].Contains(entity), "object dirty");
if (removedEntities.ContainsKey(repository))
Debug.Assert(!removedEntities[repository].Contains(entity), "object removed");
if (newEntities.ContainsKey(repository))
Debug.Assert(!newEntities[repository].Contains(entity), "object already registered new");
if (!newEntities.ContainsKey(repository))
newEntities.Add(repository, new List<IEntity>());
newEntities[repository].Add(entity);
}
开发者ID:Kaike23,项目名称:Repository,代码行数:14,代码来源:UnitOfWork.cs
示例18: CreateNextSeason
public void CreateNextSeason(string previousSeasonId, IUnitOfWorkRepository repository)
{
Season previousSeason;
using (var seasonRepository = _repositoryFactory.CreateSeasonRepository())
{
previousSeason = seasonRepository.GetOne(previousSeasonId);
}
if (previousSeason.SeasonStatus != SeasonStatus.Ended)
{
throw new ConflictException("Season must be ended before a new one can be created");
}
var newSeasonInfo = new NewSeasonInfo
{
Game = previousSeason.Game,
SeasonNumber = previousSeason.GameOrder + 1
};
// Determine which teams promote and relegate.
IEnumerable<Team> allTeamsSortedOnLeagueAndPosition;
using (var teamRepository = _repositoryFactory.CreateTeamRepository())
{
allTeamsSortedOnLeagueAndPosition = teamRepository.GetTeamsByGame(previousSeason.GameId).OrderBy(x => x.CurrentLeagueCompetition.Order).ThenBy(x => x.CurrentLeaguePosition);
}
var teamsGroupedPerLeague = allTeamsSortedOnLeagueAndPosition.GroupBy(t => t.CurrentLeagueCompetitionId).Select(grp => grp.ToList()).ToList();
var newLeagues = _leagueManager.PromoteAndRelegateTeams(teamsGroupedPerLeague);
newSeasonInfo.TeamsLeague1 = newLeagues[0];
newSeasonInfo.TeamsLeague2 = newLeagues[1];
newSeasonInfo.TeamsLeague3 = newLeagues[2];
newSeasonInfo.TeamsLeague4 = newLeagues[3];
// Determine champion of the highest league.
newSeasonInfo.NationalChampion = teamsGroupedPerLeague[0][0];
// Determine cup winner.
using (var matchRepository = new RepositoryFactory().CreateMatchRepository())
{
var cupFinal = matchRepository.GetNationalCupFinal(previousSeason.Id);
newSeasonInfo.NationalCupWinner = cupFinal.GetWinner();
}
// Now all teams have been placed in the right leagues, so create match schedules for all competitions.
var seasonAndCompetitionSchedules = CreateSeasonAndCompetitionSchedules(newSeasonInfo);
// Insert the season and all competition schedules.
InsertSeasonAndCompetitionSchedule(repository, seasonAndCompetitionSchedules);
}
开发者ID:bouwe77,项目名称:fmg,代码行数:50,代码来源:SeasonManager.cs
示例19: RegisterAdd
public void RegisterAdd(IAggregateRoot entity, IUnitOfWorkRepository unitOfWorkRepository)
{
if (_ItemQueue == null)
_ItemQueue = new Queue<UnitItem>();
UnitItem unitItem=new UnitItem()
{ Entity = entity, UnitOfWorkRepository = unitOfWorkRepository, Operator = UnitOperator.Add };
if (_ItemQueue.Contains(unitItem))
{
throw new Exception("exist Entity in RegistorAdd!");
}
else
{
_ItemQueue.Enqueue(unitItem);
}
}
开发者ID:phonia,项目名称:Turingit,代码行数:15,代码来源:UnitOfWork.cs
示例20: RegisterRemoved
/// <summary>
/// Registers an entity to be removed when commited.
/// </summary>
/// <param name="entity">Entity.</param>
/// <param name="repository">Repository.</param>
public virtual void RegisterRemoved(IAggregateRoot entity, IUnitOfWorkRepository repository)
{
Entities.Add(new EntityRepositoryPair(new UnitOfWorkEntity(entity, UnitOfWorkEntityState.Removed), repository));
}
开发者ID:GiusepeCasagrande,项目名称:Skahal.Infrastructure.Framework,代码行数:9,代码来源:MemoryUnitOfWork.cs
注:本文中的IUnitOfWorkRepository类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论