本文整理汇总了C#中IUnitOfWork类的典型用法代码示例。如果您正苦于以下问题:C# IUnitOfWork类的具体用法?C# IUnitOfWork怎么用?C# IUnitOfWork使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IUnitOfWork类属于命名空间,在下文中一共展示了IUnitOfWork类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddFowardingServer
public int AddFowardingServer(IUnitOfWork uow, ForwardingServer forwardingServer)
{
var mappedForwardingServer = Mapper.Map<SQL.Models.ForwardingServer>(forwardingServer);
var id = Convert.ToInt32(uow.Db.Insert(mappedForwardingServer));
Mapper.Map(mappedForwardingServer, forwardingServer);
return id;
}
示例2: AircraftsController
public AircraftsController(
IUnitOfWork unitOfWork,
ILotRepository lotRepository,
IInventoryRepository inventoryRepository,
IAircraftRepository aircraftRepository,
IAircraftRegistrationRepository aircraftRegistrationRepository,
IAircraftRegMarkRepository aircraftRegMarkRepository,
ISModeCodeRepository sModeCodeRepository,
IFileRepository fileRepository,
IApplicationRepository applicationRepository,
ICaseTypeRepository caseTypeRepository,
ILotEventDispatcher lotEventDispatcher,
UserContext userContext)
{
this.unitOfWork = unitOfWork;
this.lotRepository = lotRepository;
this.inventoryRepository = inventoryRepository;
this.aircraftRepository = aircraftRepository;
this.aircraftRegistrationRepository = aircraftRegistrationRepository;
this.aircraftRegMarkRepository = aircraftRegMarkRepository;
this.sModeCodeRepository = sModeCodeRepository;
this.fileRepository = fileRepository;
this.applicationRepository = applicationRepository;
this.caseTypeRepository = caseTypeRepository;
this.lotEventDispatcher = lotEventDispatcher;
this.userContext = userContext;
}
示例3: ExternalAuthSettings
public ExternalAuthSettings(IUnitOfWork unitOfWork)
: base(unitOfWork)
{
AutoRegisterEnabled = true;
GoogleSystemEnable = true;
FacebookSystemEnable = true;
}
示例4: ThreadServices
public ThreadServices(
IRepository<Thread> threadRepository,
IRepository<ThreadView> threadViewRepository,
IRepository<Post> postRepository,
IRepository<User> userRepository,
IRepository<ThreadViewStamp> threadViewStampRepository,
IRepository<Subscription> subscriptionRepository,
IRepository<Attachment> attachmentRepository,
PollServices pollServices,
FileServices fileServices,
ParseServices parseServices,
RoleServices roleServices,
IUnitOfWork unitOfWork)
: base(unitOfWork)
{
_threadRepository = threadRepository;
_threadViewRepository = threadViewRepository;
_postRepository = postRepository;
_userRepository = userRepository;
_threadViewStampRepository = threadViewStampRepository;
_subscriptionRepository = subscriptionRepository;
_attachmentRepository = attachmentRepository;
_pollServices = pollServices;
_fileServices = fileServices;
_parseServices = parseServices;
_roleServices = roleServices;
}
示例5: PatientServiceTest
public PatientServiceTest()
{
patientRepository = Substitute.For<IPatientRepository>();
unitOfWork = Substitute.For<IUnitOfWork>();
validatorService = Substitute.For<IValidatorService>();
patientService = new PatientService(patientRepository, unitOfWork, validatorService);
}
示例6: SetUp
public void SetUp()
{
mocks = new MockRepository();
instance = mocks.DynamicMock<IUnitOfWork>();
store = new ThreadedUnitOfWorkStore();
}
示例7: TagService
public TagService(IUnitOfWork unitOfWork, ITagValidation tagValidation)
: base(unitOfWork)
{
Guard.NotNull(tagValidation, "tagValidation");
this._tagValidation = tagValidation;
}
示例8: PartnershipController
//
// GET: /Partnership/
public PartnershipController(IUnitOfWork unitOfWork, PartnershipService partnershipService, StagedPartnershipService stagedPartnershipService, ChurchService churchService, PartnershipLogExcelFileHandler fileHandler) : base(unitOfWork)
{
_partnershipService = partnershipService;
_stagedPartnershipService = stagedPartnershipService;
_churchService = churchService;
_fileHandler = fileHandler;
}
示例9: AddAsync
public virtual async Task<int> AddAsync(IUnitOfWork unitOfWork, List<IUser> entities,
List<IUserRole> roles = null)
{
try
{
var result = 0;
foreach (var entity in entities)
{
result += await this.AddAsync(unitOfWork, entity);
}
if (roles != null)
{
foreach (var role in roles)
{
result += await unitOfWork.AddAsync<UserRole>(
Mapper.Map<UserRole>(role));
}
}
return result;
}
catch (Exception e)
{
throw e;
}
}
示例10: AulaService
public AulaService(IAulaRepository repoAula, IAlunoRepository repoAluno, ITurmaRepository repoTurma, IUnitOfWork unitOfWork)
{
_aulaRepository = repoAula;
_alunoRepository = repoAluno;
_turmaRepository = repoTurma;
_unitOfWork = unitOfWork;
}
示例11: Creator
public Creator(IUnitOfWork unitOfWork, IRepository<Battle> repositoryOfBattle, IRepository<User> repositoryOfUser, IRepository<Team> repositoryOfTeam)
{
_unitOfWork = unitOfWork;
_repositoryOfBattle = repositoryOfBattle;
_repositoryOfUser = repositoryOfUser;
_repositoryOfTeam = repositoryOfTeam;
}
示例12: CmsMembershipProvider
/// <summary>
/// Initializes a new instance of the <see cref="CmsMembershipProvider" /> class.
/// </summary>
/// <param name="userService">The user service.</param>
/// <param name="authenticationService">The authentication service.</param>
/// <param name="unitOfWork">The unit of work.</param>
/// <param name="membershipName">Name of the membership.</param>
internal CmsMembershipProvider(IUserService userService, IAuthenticationService authenticationService, IUnitOfWork unitOfWork, string membershipName)
{
this.authenticationService = authenticationService;
this.userService = userService;
this.unitOfWork = unitOfWork;
this.membershipName = membershipName;
}
示例13: CompositeEntitySeeder
public CompositeEntitySeeder(IUnitOfWork unitOfWork
, CoreSqlSeeder coreSqlSeeder
//, LanguageEntitySeeder languageEntitySeeder
, LanguageSqlSeeder languageSqlSeeder
, PlaceByGeoPlanetEntitySeeder placeByGeoPlanetEntitySeeder
, RoleEntitySeeder roleEntitySeeder
, EstablishmentEntitySeeder establishmentEntitySeeder
, EmailTemplateEntitySeeder emailTemplateEntitySeeder
, PersonEntitySeeder personEntitySeeder
, UserEntitySeeder userEntitySeeder
, MemberEntitySeeder memberEntitySeeder
, InstitutionalAgreementEntitySeeder institutionalAgreementEntitySeeder
, InstitutionalAgreementSettingsEntitySeeder institutionalAgreementSettingsEntitySeeder
)
{
_unitOfWork = unitOfWork;
_coreSqlSeeder = coreSqlSeeder;
_languageSqlSeeder = languageSqlSeeder;
//_languageEntitySeeder = languageEntitySeeder;
_placeByGeoPlanetEntitySeeder = placeByGeoPlanetEntitySeeder;
_roleEntitySeeder = roleEntitySeeder;
_establishmentEntitySeeder = establishmentEntitySeeder;
_emailTemplateEntitySeeder = emailTemplateEntitySeeder;
_personEntitySeeder = personEntitySeeder;
_userEntitySeeder = userEntitySeeder;
_memberEntitySeeder = memberEntitySeeder;
_institutionalAgreementEntitySeeder = institutionalAgreementEntitySeeder;
_institutionalAgreementSettingsEntitySeeder = institutionalAgreementSettingsEntitySeeder;
}
示例14: SetCurrentUow
private static void SetCurrentUow(IUnitOfWork value, ILogger logger)
{
if (value == null)
{
ExitFromCurrentUowScope(logger);
return;
}
var unitOfWorkKey = CallContext.LogicalGetData(ContextKey) as string;
if (unitOfWorkKey != null)
{
IUnitOfWork outer;
if (UnitOfWorkDictionary.TryGetValue(unitOfWorkKey, out outer))
{
if (outer == value)
{
logger.Warn("Setting the same UOW to the CallContext, no need to set again!");
return;
}
value.Outer = outer;
}
}
unitOfWorkKey = value.Id;
if (!UnitOfWorkDictionary.TryAdd(unitOfWorkKey, value))
{
throw new AbpException("Can not set unit of work! UnitOfWorkDictionary.TryAdd returns false!");
}
logger.Debug("Entering a new UOW scope: " + unitOfWorkKey);
CallContext.LogicalSetData(ContextKey, unitOfWorkKey);
}
示例15: SetUp
public static void SetUp(TestContext context)
{
_unitOfWork = new UnitOfWork();
var memberFactory = new MemberFactory();
_email = Guid.NewGuid().ToString();
_decorator = new MemberDecorator(memberFactory, _unitOfWork.MemberRepository);
_oldCount = _unitOfWork.MemberRepository.Count();
_member = memberFactory.CreateMember(_email);
_sameMember = memberFactory.CreateMember(_email);
_decorator.Add(_member);
_unitOfWork.PersistAll();
using (var uow = new UnitOfWork())
{
_newCount = uow.MemberRepository.Count();
try
{
_loadedMember = uow.MemberRepository.Get(_member.Id);
}
catch (Exception)
{
_loadedMember = null;
}
}
}