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


C# IUnitOfWork.Repository方法代码示例

本文整理汇总了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>();
        }
开发者ID:chiselko6,项目名称:Glinterion,代码行数:7,代码来源:PhotoSaveService.cs

示例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>();
 }
开发者ID:rajgit31,项目名称:NotesManagerEf-POC,代码行数:9,代码来源:NotesManagerService.cs

示例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>();
        }
开发者ID:chiselko6,项目名称:Glinterion,代码行数:10,代码来源:PhotosController.cs

示例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>();
        }
开发者ID:rajgit31,项目名称:NotesManage-FluentQuery,代码行数:17,代码来源:NotesService.cs

示例5: StudentManagerService

 public StudentManagerService(IUnitOfWork unitOfWork)
 {
     _unitOfWork = unitOfWork;
     _studentRepo = _unitOfWork.Repository<Student>();
     _mappingRepo = _unitOfWork.Repository<FriendStudentMapping>();
 }
开发者ID:rajgit31,项目名称:NotesManagerEf-POC,代码行数:6,代码来源:StudentManagerService.cs

示例6: HtmlPageService

 public HtmlPageService(IUnitOfWork unitOfWork)
 {
     _unitOfWork = unitOfWork;
     _pagerepos = _unitOfWork.Repository<HtmlPage>();
 }
开发者ID:Joefrank,项目名称:fromplaytobow.co.uk,代码行数:5,代码来源:HtmlPageService.cs

示例7: TransactionController

 public TransactionController(IUnitOfWork unitOfWork)
 {
     _unitOfWork = unitOfWork;
     transactionRepository = _unitOfWork.Repository<Transaction>();
 }
开发者ID:anary,项目名称:kpmgtest,代码行数:5,代码来源:TransactionController.cs

示例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;
     }
 }
开发者ID:jigshGitHub,项目名称:SandlerTrainingDevelopment,代码行数:27,代码来源:UserModel.cs

示例9: HomeController

 public HomeController(IUnitOfWork unitOfWork)
 {
     _unitOfWork = unitOfWork;
     _shopRepository = _unitOfWork.Repository<Shop>();
 }
开发者ID:PavelP4,项目名称:LPShops,代码行数:5,代码来源:HomeController.cs

示例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;
 }
开发者ID:ramesh533,项目名称:FlickSome,代码行数:27,代码来源:ModelFactory.cs

示例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;
        }
开发者ID:ramesh533,项目名称:FlickSome,代码行数:44,代码来源:ModelFactory.cs

示例12: MemberService

 public MemberService(IUnitOfWork unitOfWork)
 {
     this.unitOfWork = unitOfWork;
     this.repository = unitOfWork.Repository<Member>();
 }
开发者ID:ninadsakhadev,项目名称:TeamManager,代码行数:5,代码来源:MemberService.cs

示例13: CategoryService

 public CategoryService(IUnitOfWorkFactory factory)
 {
     _unitOfWork = factory.Create();
    _repository = _unitOfWork.Repository<Category>();
 }
开发者ID:devSlike,项目名称:NewTasks,代码行数:5,代码来源:CategoryService.cs

示例14: SubTaskService

 public SubTaskService(IUnitOfWorkFactory factory)
 {
     _unitOfWork = factory.Create();
     _taskRepository = _unitOfWork.Repository<Task>();
     _repository = _unitOfWork.Repository<SubTask>();
 }
开发者ID:devSlike,项目名称:NewTasks,代码行数:6,代码来源:SubTaskService.cs

示例15: WorkoutsController

 public WorkoutsController(IUnitOfWork uow)
 {
     unitOfWork = uow;
     repository = unitOfWork.Repository<long, Workouts>();
 }
开发者ID:BlaBlaRun,项目名称:WebSite,代码行数:5,代码来源:WorkoutsController.cs


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