本文整理汇总了C#中IUnitOfWork.Repository方法的典型用法代码示例。如果您正苦于以下问题:C# IUnitOfWork.Repository方法的具体用法?C# IUnitOfWork.Repository怎么用?C# IUnitOfWork.Repository使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IUnitOfWork
的用法示例。
在下文中一共展示了IUnitOfWork.Repository方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PhotoSaveService
public PhotoSaveService(IUnitOfWork uof)
{
photosDb = uof.Repository<Photo>();
usersDb = uof.Repository<User>();
accountsDb = uof.Repository<Account>();
}
示例2: NotesManagerService
public NotesManagerService(IUnitOfWork unitOfWork)
{
_unitOfWork = unitOfWork;
_noteRepo = _unitOfWork.Repository<Note>();
_fillerFormRepo = _unitOfWork.Repository<FillerForm>();
_questionAnswerMapRepo = _unitOfWork.Repository<QuestionAnswerMapping>();
_acpAnswerRepo = _unitOfWork.Repository<AcpAnswer>();
_acpQuesListItemRepo = _unitOfWork.Repository<AcpQuestionListItem>();
}
示例3: PhotosController
public PhotosController()
{
uof = DependencyResolver.Current.GetService<IUnitOfWork>();
accountsDb = uof.Repository<Account>();
rolesDb = uof.Repository<Role>();
usersDb = uof.Repository<User>();
photosDb = uof.Repository<Photo>();
photoSaveService = DependencyResolver.Current.GetService<PhotoSaveService>();
}
示例4: NotesService
public NotesService(IUnitOfWork unitOfWork, IQueries queries)
{
if (unitOfWork == null)
{
throw new ArgumentNullException("unitOfWork");
}
if (queries == null)
{
throw new ArgumentNullException("queries");
}
_queries = queries;
_unitOfWork = unitOfWork;
_notesRepository = _unitOfWork.Repository<Note>();
}
示例5: StudentManagerService
public StudentManagerService(IUnitOfWork unitOfWork)
{
_unitOfWork = unitOfWork;
_studentRepo = _unitOfWork.Repository<Student>();
_mappingRepo = _unitOfWork.Repository<FriendStudentMapping>();
}
示例6: HtmlPageService
public HtmlPageService(IUnitOfWork unitOfWork)
{
_unitOfWork = unitOfWork;
_pagerepos = _unitOfWork.Repository<HtmlPage>();
}
示例7: TransactionController
public TransactionController(IUnitOfWork unitOfWork)
{
_unitOfWork = unitOfWork;
transactionRepository = _unitOfWork.Repository<Transaction>();
}
示例8: Load
public void Load(IUnitOfWork uow)
{
TBL_COACH coach;
switch (this.Role)
{
case SandlerRoles.Coach:
coach = uow.Repository<TBL_COACH>().GetAll().Where(r => r.UserID == this.UserId).SingleOrDefault();
this.CoachID = coach.ID;
this.RegionID = uow.Repository<TBL_REGION>().GetById(coach.RegionID).ID;
break;
case SandlerRoles.FranchiseeOwner:
case SandlerRoles.FranchiseeUser:
case SandlerRoles.Client:
this.FranchiseeID = uow.Repository<TBL_FRANCHISEE_USERS>().GetAll().Where(r => r.UserID == this.UserId).SingleOrDefault().FranchiseeID;
TBL_FRANCHISEE franchisee = uow.Repository<TBL_FRANCHISEE>().GetAll().Where(r => r.ID == this.FranchiseeID).SingleOrDefault();
this.FranchiseeName = franchisee.Name;
coach = uow.Repository<TBL_COACH>().GetById(franchisee.CoachID);
this.CoachID = coach.ID;
this.RegionID = uow.Repository<TBL_REGION>().GetById(coach.RegionID).ID;
break;
case SandlerRoles.SiteAdmin:
case SandlerRoles.HomeOfficeAdmin:
break;
default:
break;
}
}
示例9: HomeController
public HomeController(IUnitOfWork unitOfWork)
{
_unitOfWork = unitOfWork;
_shopRepository = _unitOfWork.Repository<Shop>();
}
示例10: TryParse
public bool TryParse(MovieReview review, ReviewModel reviewModel, IUnitOfWork _unitOfWork, ModelStateDictionary modelState)
{
bool isValid = true;
var movie = _unitOfWork.Repository<Movie>().Query()
.Filter(m => m.Title.ToLower() == reviewModel.Movie.ToLower())
.FirstOrDefault();
if (movie == null)
{
modelState.AddModelError("Movie", "Not a valid Movie");
isValid = false;
}
var reviewer = _unitOfWork.Repository<Reviewer>().Query()
.Filter(r => r.Name.ToLower() == reviewModel.Reviewer.ToLower())
.FirstOrDefault();
if (reviewer == null)
{
modelState.AddModelError("Reviewer", "Not a valid Reviewer");
isValid = false;
}
review.Movie = movie;
review.Reviewer = reviewer;
review.ReviewedDate = reviewModel.ReviewedDate;
review.TagLine = reviewModel.TagLine;
review.Rating = reviewModel.Rating;
review.Review = reviewModel.Review;
return isValid;
}
示例11: ParseArtists
private ICollection<MovieArtist> ParseArtists(Movie movie, MovieModel movieModel, IUnitOfWork _unitOfWork)
{
MovieArtist movieArtist;
ArtistRole[] roles = { ArtistRole.Hero, ArtistRole.Heroin, ArtistRole.Director, ArtistRole.Producer, ArtistRole.MusicDirector };
string artistName;
if (movie.Artists == null)
{
movie.Artists = new List<MovieArtist>();
}
foreach (var role in roles)
{
artistName = movieModel.GetNameByRole(role);
if (!string.IsNullOrEmpty(artistName))
{
var artist = _unitOfWork.Repository<Artist>().Query().Filter(a => string.Equals(artistName, a.Name)).FirstOrDefault();
if (artist == null)
{
artist = new Artist() { Name = artistName, PrimaryRole = role, State = ObjectState.Added };
}
if (string.IsNullOrEmpty(movie.GetArtistName(role)))
{
movieArtist = new MovieArtist() { Artist = artist, Movie = movie, Role = role, State = ObjectState.Added };
movie.Artists.Add(movieArtist);
}
else if (movie.GetArtistName(role) != artistName)
{
movieArtist = movie.Artists.Where(ma => ma.Role == role).FirstOrDefault();
movieArtist.Artist = artist;
movieArtist.State = ObjectState.Modified;
}
}
else if (!string.IsNullOrEmpty(movie.GetArtistName(role)))
{
movieArtist = movie.Artists.Where(ma => ma.Role == role).FirstOrDefault();
movieArtist.State = ObjectState.Deleted;
}
}
return movie.Artists;
}
示例12: MemberService
public MemberService(IUnitOfWork unitOfWork)
{
this.unitOfWork = unitOfWork;
this.repository = unitOfWork.Repository<Member>();
}
示例13: CategoryService
public CategoryService(IUnitOfWorkFactory factory)
{
_unitOfWork = factory.Create();
_repository = _unitOfWork.Repository<Category>();
}
示例14: SubTaskService
public SubTaskService(IUnitOfWorkFactory factory)
{
_unitOfWork = factory.Create();
_taskRepository = _unitOfWork.Repository<Task>();
_repository = _unitOfWork.Repository<SubTask>();
}
示例15: WorkoutsController
public WorkoutsController(IUnitOfWork uow)
{
unitOfWork = uow;
repository = unitOfWork.Repository<long, Workouts>();
}