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


C# Repository.GetAll方法代码示例

本文整理汇总了C#中Repository.GetAll方法的典型用法代码示例。如果您正苦于以下问题:C# Repository.GetAll方法的具体用法?C# Repository.GetAll怎么用?C# Repository.GetAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Repository的用法示例。


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

示例1: GetAll

 public static List<UserLocationDO> GetAll()
 {
     Repository<vBO_UserLocation> rep = new Repository<vBO_UserLocation>(CheckoutDataContextProvider.Instance);
     List<vBO_UserLocation> rawLst = rep.GetAll().ToList();
     List<UserLocationDO> lst = Mapper.Map<List<vBO_UserLocation>, List<UserLocationDO>>(rawLst);
     return Mapper.Map<List<vBO_UserLocation>, List<UserLocationDO>>(rep.GetAll().ToList());
 }
开发者ID:NGITechnology,项目名称:BeymenCheckout,代码行数:7,代码来源:UserLocationBL.cs

示例2: AddTest

 public void AddTest()
 {
     IRepository<Pacient> rep = new Repository<Pacient>(path);
     int i = rep.GetAll().Count();
     rep.Save(new Pacient() { Id = 10, FirstName = "2", LastName = "3" });
     Assert.AreEqual(i + 1, rep.GetAll().Count());
 }
开发者ID:WilliamRobertMontgomery,项目名称:asp-dot-net-training-project,代码行数:7,代码来源:RepositoryTest.cs

示例3: Delete

        public void Delete()
        {
            using (var context = new MainContext())
            {
                var myRepo = new Repository<Core.Customer>(context);
                TotalCustomersBeforeTestRuns = myRepo.GetAll().Count();

                var allEntities = myRepo.GetAll().ToList();
                if (allEntities.Count > 0)
                {
                    //Find an entity to be removed.
                    var firstClientInTheDb = allEntities.FirstOrDefault();

                    //Check if there is an entity to be removed
                    if (firstClientInTheDb != null)
                    {
                        myRepo.Remove(firstClientInTheDb.Id);
                        myRepo.Save();

                        TotalOfClientsAfterTheTestRuns = myRepo.GetAll().Count();

                        // Check if the total number of entites was reduced by one.
                        Assert.AreEqual(TotalCustomersBeforeTestRuns - 1, TotalOfClientsAfterTheTestRuns);
                    }

                }
            }
        }
开发者ID:rafaelfernandesnet,项目名称:HotelClub,代码行数:28,代码来源:ClientRepositoryCanDelete.cs

示例4: Insert

        public void Insert()
        {
            using (var context = new MainContext())
            {
                var myRepo = new Repository<Address>(context);
                TotalAdresssBeforeTestRuns = myRepo.GetAll().Count();

                //Have to provide a valid name and e-mail address
                MyNewAddress = new Address
                {
                    AddressLine1 = "Barão de Mesquita Street",
                    AddressLine2 = "Tijuca",
                    Country = MyCountryTest,
                    State = "RJ",
                    Zip = "20540-156"
                };

                myRepo.Add(MyNewAddress);
                myRepo.Save();

                TotalOfClientsAfterTheTestRuns = myRepo.GetAll().Count();

                //Assert that the number of clients increase by 1
                Assert.AreEqual(TotalAdresssBeforeTestRuns + 1, TotalOfClientsAfterTheTestRuns);
            }
        }
开发者ID:rafaelfernandesnet,项目名称:HotelClub,代码行数:26,代码来源:AddressRepositoryCanInsert.cs

示例5: GetAll

        public void GetAll()
        {
            Repository repository = new Repository();

            List<UserModel> userList = repository.GetAll<UserModel>();
            List<ProjectModel> projects = repository.GetAll<ProjectModel>();
            List<ActivityModel> activities = repository.GetAll<ActivityModel>();
            List<ProjectUser> projectsUsers = repository.GetAll<ProjectUser>();
        }
开发者ID:eduardohdzc,项目名称:pmsys_sim,代码行数:9,代码来源:RepositoryTests.cs

示例6: BasicCrud

        public void BasicCrud()
        {
            using (var trans = DataSource.BeginTransaction())
            {

                var repo = new Repository<Employee, int>(trans, EmployeeTableName);

                var emp1 = new Employee() { FirstName = "Tom", LastName = "Jones", Title = "President" };
                var echo1 = repo.Insert(emp1);

                Assert.AreNotEqual(0, echo1.EmployeeKey, "EmployeeKey was not set");
                Assert.AreEqual(emp1.FirstName, echo1.FirstName, "FirstName");
                Assert.AreEqual(emp1.LastName, echo1.LastName, "LastName");
                Assert.AreEqual(emp1.Title, echo1.Title, "Title");

                echo1.MiddleName = "G";
                repo.Update(echo1);

                var emp2 = new Employee() { FirstName = "Lisa", LastName = "Green", Title = "VP Transportation", ManagerKey = echo1.EmployeeKey };
                var echo2 = repo.Insert(emp2);
                Assert.AreNotEqual(0, echo2.EmployeeKey, "EmployeeKey was not set");
                Assert.AreEqual(emp2.FirstName, echo2.FirstName, "FirstName");
                Assert.AreEqual(emp2.LastName, echo2.LastName, "LastName");
                Assert.AreEqual(emp2.Title, echo2.Title, "Title");
                Assert.AreEqual(emp2.ManagerKey, echo2.ManagerKey, "ManagerKey");

                var list = repo.GetAll();
                Assert.IsTrue(list.Any(e => e.EmployeeKey == echo1.EmployeeKey), "Employee 1 is missing");
                Assert.IsTrue(list.Any(e => e.EmployeeKey == echo2.EmployeeKey), "Employee 2 is missing");

                var get1 = repo.Get(echo1.EmployeeKey.Value);
                Assert.AreEqual(echo1.EmployeeKey, get1.EmployeeKey);



                var whereSearch1 = repo.Query("FirstName = @FN", new { FN = "Tom" });
                Assert.IsTrue(whereSearch1.Any(x => x.EmployeeKey == echo1.EmployeeKey), "Emp1 should have been returned");
                Assert.IsTrue(whereSearch1.All(x => x.FirstName == "Tom"), "Checking for incorrect return values");

                var whereSearch2 = repo.Query(new { FirstName = "Tom" });
                Assert.IsTrue(whereSearch2.Any(x => x.EmployeeKey == echo1.EmployeeKey), "Emp1 should have been returned");
                Assert.IsTrue(whereSearch2.All(x => x.FirstName == "Tom"), "Checking for incorrect return values");


                repo.Delete(echo2.EmployeeKey.Value);
                repo.Delete(echo1.EmployeeKey.Value);

                var list2 = repo.GetAll();
                Assert.AreEqual(list.Count - 2, list2.Count);

                trans.Commit();
            }

        }
开发者ID:docevaad,项目名称:Chain,代码行数:54,代码来源:TransactionalRepositoryTests.cs

示例7: DeleteTest

 public void DeleteTest()
 {
     IRepository<Pacient> rep = new Repository<Pacient>(path);
     int i = rep.GetAll().Count();
     rep.Remove(10);
     if (i > 0)
     {
         i--;
     }
     else
     {
         i = 0;
     }
     Assert.AreEqual(rep.GetAll().Count(), i);
 }
开发者ID:WilliamRobertMontgomery,项目名称:asp-dot-net-training-project,代码行数:15,代码来源:RepositoryTest.cs

示例8: Initialize

        public UserControl Initialize(ActionBarView actionBar, string databaseName)
        {
            mDatabaseName = databaseName;

            UserControl view = new MitarbeiterverwaltungView();
            
            mEmployeeRepository =
                new Repository<Employee>(
                    mDatabaseName);
                //TODO: hier den absoluten Verweis ersetzen
            //mAddressRepository = new Repository<Address>(databaseName);
            mViewModel = new MitarbeiterverwaltungViewModel
                             {
                                 Models = new ObservableCollection<Employee>(mEmployeeRepository.GetAll()),
                                 SelectedModel = null
                             };
            view.DataContext = mViewModel;

            mActionBarViewModel = new ActionBarViewModel
                                      {
                                          Command1 = new RelayCommand(AddCommandExecute),
                                          Command2 = new RelayCommand(DeleteCommandExecute, DeleteCommandCanExecute),
                                          Command3 = new RelayCommand(SaveCommandExecute, SaveCommandCanExecute),
                                          Command1Text = "Neu",
                                          Command2Text = "Löschen",
                                          Command3Text = "Speichern"
                                      };
            actionBar.DataContext = mActionBarViewModel;
            return view;
        }
开发者ID:JanUlrich,项目名称:CScharf---Projekt,代码行数:30,代码来源:MitarbeiterverwaltungController.cs

示例9: ReadAll

 public List<Tweets> ReadAll()
 {
     using (Repository<Tweets> DataAccessHelper = new Repository<Tweets>())
     {
         return DataAccessHelper.GetAll().ToList();
     }
 }
开发者ID:Kereru2014Sharpies,项目名称:TwitterRuRu,代码行数:7,代码来源:PersistTweetModel.cs

示例10: AktualisiereAnzeige

 private void AktualisiereAnzeige()
 {
     mOrderRepository = new Repository<Order>(mDatabaseName);
     mOrderlineRepository = new Repository<OrderLine>(mDatabaseName);
     mCompleteOrders = CompleteOrder.GeneriereOrders(mOrderRepository.GetAll(), mOrderlineRepository.GetAll());
     Anzeigen(mCompleteOrders);
 }
开发者ID:JanUlrich,项目名称:CScharf---Projekt,代码行数:7,代码来源:AuftragsverwaltungController.cs

示例11: CorrectStates

		internal static void CorrectStates()
		{
			int c = 0;
			Console.ForegroundColor = ConsoleColor.Yellow;
			Console.WriteLine("4. Fix all missing mainProduct refs in all states in db");
			Console.ForegroundColor = ConsoleColor.DarkGray;

			//actual db shit
			using (var ctx = new SoheilEdmContext())
			{
				var repo = new Repository<FPC>(ctx);
				var all = repo.GetAll();
				foreach (var fpc in all)
				{
					foreach (var state in fpc.States.Where(x => x.StateType == Soheil.Common.StateType.Mid))
					{
						if (state.OnProductRework == null)
						{
							state.OnProductRework = fpc.Product.MainProductRework;
							c++;
							Console.WriteLine(string.Format("FPC with ID {0} : State with ID {1} corrected.", fpc.Id, state.Id));
						}
					}
				}
				ctx.Commit();
			}

			//result
			Console.ForegroundColor = ConsoleColor.Green;
			Console.WriteLine(string.Format("{0} States corrected successfully.", c));
		}
开发者ID:T1Easyware,项目名称:Soheil,代码行数:31,代码来源:FpcState.cs

示例12: findAll

        public List<player> findAll()
        {
            Repository<player> players = new Repository<player>();
            List<player> list = (List<player>)players.GetAll().ToList();

            return list;
        }
开发者ID:rubymen,项目名称:BowlingAPI,代码行数:7,代码来源:ServicePlayer.cs

示例13: GetAllLocation

 private static List<LocationDO> GetAllLocation()
 {
     Repository<vStore_Location> rep = new Repository<vStore_Location>(CheckoutDataContextProvider.Instance);
     List<vStore_Location> list = rep.GetAll().ToList();
     list.ForEach(x => x.Code = x.Code.Trim());
     return Mapper.Map<List<vStore_Location>, List<LocationDO>>(list);
 }
开发者ID:NGITechnology,项目名称:BeymenCheckout,代码行数:7,代码来源:LocationBL.cs

示例14: SaveCommandExecute

 private void SaveCommandExecute(object obj)
 {
     var mModel = mViewModel.SelectedModel;
     var adressen = new List<Address>();
     //string fehler = "";
     var addressRepository = new Repository<Address>(mDatabaseName);
     adressen = addressRepository.GetAll();
     try
     {
         mModel.Address = Address.KontrolliereMitDatenbank(mModel.Address, adressen);
         try
         {
             mCustomerRepository.Save(mModel);
         }
         catch (Exception)
         {
             MessageBox.Show("Kundennummer ist bereits vorhanden");
         }
     }
     catch (WrongCityPostalCodeCombination excp)
     {
         //fehler = "Fehler: Die Kombination aus Postleitzahl und Städtenamen ist nicht korrekt";
         MessageBox.Show("Fehler: Die Kombination aus Postleitzahl und Städtenamen ist nicht korrekt!\n" + excp.Message);
     }
 }
开发者ID:JanUlrich,项目名称:CScharf---Projekt,代码行数:25,代码来源:KundenverwaltungController.cs

示例15: SetScheduledJobs

        private static void SetScheduledJobs(QuartzServer server, IList<Type> implementedJobs)
        {
            var jobConfigDetailsRepository = new Repository<JobConfigurationDetails>();
            foreach (var implementedJob in implementedJobs)
            {
                var jobConfiguration = jobConfigDetailsRepository.GetAll().FirstOrDefault(x => x.Name == implementedJob.Name);
                if (jobConfiguration != null)
                {
                    IJobDetail job = JobBuilder.Create(implementedJob).WithIdentity(implementedJob.Name, "group1").Build();
                    ITrigger trigger = TriggerBuilder.Create()
                        .WithIdentity(implementedJob.Name + "trigger", "group1")
                        .StartNow()
                        .WithSimpleSchedule(x => x
                                                     .WithIntervalInSeconds((int)jobConfiguration.TriggerTimeInSec)
                                                     .RepeatForever())
                        .Build();

                    server.Scheduler.ScheduleJob(job, trigger);
                }
                else
                {
                    _log.DebugFormat("Job was not configured in db. JobName={0}", implementedJob.Name);
                }
            }
        }
开发者ID:redrhino,项目名称:autoMT4,代码行数:25,代码来源:Program.cs


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