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


C# GenericRepository.GetAll方法代码示例

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


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

示例1: GetData

        public void GetData()
        {
            GenericRepository<t_loan_lead> loan = new GenericRepository<t_loan_lead>(new sherlockEntities());
            loan.GetAll();

            GenericRepository<t_life_lead> life = new GenericRepository<t_life_lead>(new sherlockEntities());
            life.GetAll();

            GenericRepository<t_asu_lead> asu = new GenericRepository<t_asu_lead>(new sherlockEntities());
            asu.GetAll();

            GenericRepository<t_debt_lead> debt = new GenericRepository<t_debt_lead>(new sherlockEntities());
            debt.GetAll();

            GenericRepository<t_equityrelease_lead> equityrelease = new GenericRepository<t_equityrelease_lead>(new sherlockEntities());
            equityrelease.GetAll();

            GenericRepository<t_logbookloan_lead> logbookloan = new GenericRepository<t_logbookloan_lead>(new sherlockEntities());
            logbookloan.GetAll();

            GenericRepository<t_mortgage_lead> mortgage = new GenericRepository<t_mortgage_lead>(new sherlockEntities());
            mortgage.GetAll();

            GenericRepository<t_pmi_lead> pmi = new GenericRepository<t_pmi_lead>(new sherlockEntities());
            pmi.GetAll();

            GenericRepository<t_ppi_lead> ppi = new GenericRepository<t_ppi_lead>(new sherlockEntities());
            ppi.GetAll();

            GenericRepository<t_sme_mi_lead> sme_mi = new GenericRepository<t_sme_mi_lead>(new sherlockEntities());
            sme_mi.GetAll();

            GenericRepository<t_solar_lead> solar = new GenericRepository<t_solar_lead>(new sherlockEntities());
            solar.GetAll();
        }
开发者ID:indrajitdan,项目名称:Sherlock,代码行数:35,代码来源:Class1.cs

示例2: Form1

        public Form1()
        {
            InitializeComponent();

            _repository = new GenericRepository<Word>();

            _words = _repository.GetAll().ToList();

            this.LoadGrid();
        }
开发者ID:luizearaujo,项目名称:FinancialDic,代码行数:10,代码来源:Form1.cs

示例3: DbLookup

        private DbLookup() 
        {
            IRepository repository = new GenericRepository(new SmartGatewayEntities());        
            IEnumerable<GatewayConfig> gcList = repository.GetAll<GatewayConfig>().OrderBy(gc=>gc.Id);

            List<string> names = new List<string>();
            foreach (GatewayConfig c in gcList)
            {
                names.Add(c.Id);
            }
            Channels = new SelectList(names);
        }
开发者ID:TEGUHRI,项目名称:messagingtoolkit-smartgateway,代码行数:12,代码来源:Definition.cs

示例4: printJSON

        private static void printJSON(string p)
        {
            var repo = new GenericRepository<Girl>
                (new GirlsAgencyContext());
            switch (p)
            {
                // TODO finish this
                case "Girls":

                    JavaScriptSerializer jss = new JavaScriptSerializer();
                    var entities = repo.GetAll().Select(g => new
                    {
                        FirstName = g.FirstName,
                        LastName = g.LastName,
                        BreastSize = ((BreastSizeEnum)g.BreastSizeId).ToString(),
                        City = g.City.Name,
                        Country = g.Country.Name,
                        HairColor = ((HairColorEnum)g.HairColorId).ToString(),
                        Customers = g.Customers.Select(c => c.FirstName + " " + c.LastName)

                    });
                    Console.WriteLine(jss.Serialize(entities));
                    break;
            }
        }
开发者ID:TeamCurrant,项目名称:GirlsAgency,代码行数:25,代码来源:CommandEngine.cs

示例5: GetGirls

        private static ICollection<Girl> GetGirls(Customer mssqlCustomer, GenericRepository<Girl> girlsMySql)
        {
            var girls = new List<Girl>();
            foreach (var girl in mssqlCustomer.Girls)
            {
                var girlInDb = girlsMySql
                    .GetAll()
                    .Where(n => n.FirstName == girl.FirstName && n.LastName == girl.LastName)
                    .FirstOrDefault();

                girls.Add(girlInDb);
            }

            return girls;
        }
开发者ID:TeamCurrant,项目名称:GirlsAgency,代码行数:15,代码来源:CommandEngine.cs

示例6: ExportOrdersFromMSSqlToMySql

        private static void ExportOrdersFromMSSqlToMySql(GenericRepository<Order> sqlOrdersRepo, GenericRepository<Order> mysSqlOrdersRepo)
        {
            var girlsMysql = new GenericRepository<Girl>(new GirlAgencyMySql.Data.MySql());
            var customersMysq = new GenericRepository<Customer>(new GirlAgencyMySql.Data.MySql());
            foreach (var orderFromSql in sqlOrdersRepo.GetAll().ToList())
            {
                //Console.WriteLine(orderFromSql.);
                var order = new Order()
                {
                    GirlId =
                        girlsMysql
                            .GetAll()
                            .FirstOrDefault(g => g.FirstName == orderFromSql.Girl.FirstName && g.LastName == orderFromSql.Girl.LastName).Id,
                    CustomerId =
                        customersMysq
                            .GetAll()
                            .FirstOrDefault(c => c.FirstName == orderFromSql.Customer.FirstName &&
                                    c.LastName == orderFromSql.Customer.LastName).Id,
                    Duration = orderFromSql.Duration,
                    Date = orderFromSql.Date
                };

                mysSqlOrdersRepo.Add(order);
            }

            mysSqlOrdersRepo.SaveChanges();
        }
开发者ID:TeamCurrant,项目名称:GirlsAgency,代码行数:27,代码来源:CommandEngine.cs

示例7: ExportGirlsFromMSSqlToMySql

 private static void ExportGirlsFromMSSqlToMySql(GenericRepository<Girl> sqlGirlsRepo, GenericRepository<Girl> mySqlGirlsRepo)
 {
     var girlsFromMSsql = sqlGirlsRepo.GetAll().ToList();
     foreach (var girlFromMSsql in girlsFromMSsql.ToList())
     {
         var girl = new Girl()
         {
             FirstName = girlFromMSsql.FirstName,
             LastName = girlFromMSsql.LastName,
             Age = girlFromMSsql.Age,
             BreastSizeId = girlFromMSsql.BreastSizeId,
             HairColorId = girlFromMSsql.HairColorId,
             CityId = girlFromMSsql.CityId,
             PricePerHour = girlFromMSsql.PricePerHour,
             Features = girlFromMSsql.Features,
             CountyId = girlFromMSsql.CountyId,
             // City = girlFromMSsql.City,
             // Country = girlFromMSsql.Country
         };
         mySqlGirlsRepo.Add(girl);
         mySqlGirlsRepo.SaveChanges();
     }
 }
开发者ID:TeamCurrant,项目名称:GirlsAgency,代码行数:23,代码来源:CommandEngine.cs

示例8: ExportCustomerFromMSSqlToMySQL

        private static void ExportCustomerFromMSSqlToMySQL()
        {
            var mssqlClients = new GenericRepository<Customer>(new GirlsAgencyContext());
            var girlsMySql = new GenericRepository<Girl>(new GirlAgencyMySql.Data.MySql());
            var mysqlClients = new GenericRepository<Customer>(new GirlAgencyMySql.Data.MySql());
            foreach (var mssqlCustomer in mssqlClients.GetAll().ToList())
            {
                var customer = new Customer()
                {
                    CityId = mssqlCustomer.CityId,
                    CountryId = mssqlCustomer.CountryId,
                    FirstName = mssqlCustomer.FirstName,
                    LastName = mssqlCustomer.LastName,
                    Girls = GetGirls(mssqlCustomer, girlsMySql)
                };

                mysqlClients.Add(customer);
            }

            mysqlClients.SaveChanges();
        }
开发者ID:TeamCurrant,项目名称:GirlsAgency,代码行数:21,代码来源:CommandEngine.cs

示例9: ExportCountriesFromMSSqlToMySql

 private static void ExportCountriesFromMSSqlToMySql(GenericRepository<Country> sqlCountriesRepo, GenericRepository<Country> mySqlCountriesRepo)
 {
     var countriesFromMSsql = sqlCountriesRepo.GetAll().ToList();
     foreach (var countryFromMSsql in countriesFromMSsql.ToList())
     {
         var country = new Country()
         {
             Name = countryFromMSsql.Name
         };
         mySqlCountriesRepo.Add(country);
         mySqlCountriesRepo.SaveChanges();
     }
 }
开发者ID:TeamCurrant,项目名称:GirlsAgency,代码行数:13,代码来源:CommandEngine.cs

示例10: ExportCitiesFromMSSqlToMySQL

 private static void ExportCitiesFromMSSqlToMySQL(GenericRepository<City> sqlCitiesRepo, GenericRepository<City> mySqlCitiesRepo)
 {
     var mysqlCountries = new GenericRepository<Country>(new GirlAgencyMySql.Data.MySql());
     var citiesFromMSsql = sqlCitiesRepo.GetAll().ToList();
     foreach (var cityFromMSsql in citiesFromMSsql.ToList())
     {
         var city = new City()
         {
             Name = cityFromMSsql.Name,
             CountryId = mysqlCountries.
                 GetAll()
                 .FirstOrDefault(n => n.CountryId == cityFromMSsql.CountryId).CountryId
         };
         mySqlCitiesRepo.Add(city);
         mySqlCitiesRepo.SaveChanges();
     }
 }
开发者ID:TeamCurrant,项目名称:GirlsAgency,代码行数:17,代码来源:CommandEngine.cs

示例11: OnActionExecuting

        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            if (filterContext == null)
            {
                throw new ArgumentNullException("filterContext");
            }
            string path = filterContext.HttpContext.Request.Path.ToLower();
            if (path == "/" || path == "/Login/Index".ToLower() || path == "/Login/Login".ToLower()
                || path == "/Login/GetValidateCode".ToLower())
            {
                return; //忽略权限判定
            }

            if (!CheckLogin(filterContext))
            {

                string rawUrl = filterContext.HttpContext.Request.RawUrl;
                string allUrl = filterContext.HttpContext.Request.Url.ToString();
                int index = allUrl.IndexOf(rawUrl);
                string url = allUrl.Substring(0, index);
                if (filterContext.HttpContext.Request.IsAjaxRequest())
                {
                    filterContext.HttpContext.Response.StatusCode = 499; //尽量不要与现有的Http状态码冲突

                }

                filterContext.Result = new ContentResult
                {
                    Content =
                        "<script language =\"javascript\" type =\"text/javascript\" >alert(\"登录超时!\");window.top.location.href = \"" +
                        url + "/Login/Index\";</script>"
                };
            }
            else
            {
                string roleCode = filterContext.HttpContext.Session["UiRoles"].ToString();
                if (_list.Count == 0)
                {
                    Guid id = Guid.Parse(roleCode);
                    using (IRoleManager iRoleManager = new RoleManager())
                    {
                        Role role = iRoleManager.GetById(id);

                        if (role != null)
                        {
                            using (
                                IGenericRepository<ResourceRole> iResourceRoleRepository =
                                    new GenericRepository<ResourceRole>())
                            {
                                IList<ResourceRole> reRl = iResourceRoleRepository.SearchFor(p => p.RlID.Equals(id));
                                IGenericRepository<Resource> resRepository = new GenericRepository<Resource>();
                                IList<Resource> relist = resRepository.GetAll();
                                foreach (var resourceRole in reRl)
                                {
                                    Resource res = relist.First(p => p.ResourceID.Equals(resourceRole.ReID));
                                    if (res.ReType.Equals("1") && res.State.Equals("0")&&res.URL!=null)
                                    {
                                        _list.Add(res.URL);
                                    }
                                }
                            }

                        }
                        else
                        {
                            string rawUrl = filterContext.HttpContext.Request.RawUrl;
                            string allUrl = filterContext.HttpContext.Request.Url.ToString();
                            int index = allUrl.IndexOf(rawUrl);
                            string url = allUrl.Substring(0, index);
                            filterContext.Result = new ContentResult
                            {
                                Content =
                                    "<script language =\"javascript\" type =\"text/javascript\" >alert(\"无权访问此页!\");window.top.location.href = \"" +
                                    url + "/Login/Index\";</script>"
                            };
                        }
                    }
                }
                //if (_list.Where(p => p.ToLower().Equals(path)).Count() == 0)
                //{
                //    string rawUrl = filterContext.HttpContext.Request.RawUrl;
                //    string allUrl = filterContext.HttpContext.Request.Url.ToString();
                //    int index = allUrl.IndexOf(rawUrl);
                //    string url = allUrl.Substring(0, index);
                //    filterContext.Result = new ContentResult
                //    {
                //        Content =
                //            "<script language =\"javascript\" type =\"text/javascript\" >alert(\"无权访问此页!\");window.top.location.href = \"" +
                //            url + "/Login/Index\";</script>"
                //    };
                //}

            }
        }
开发者ID:pjjwpc,项目名称:SCZYDJGJK,代码行数:94,代码来源:AuthorizeFilterAttribute.cs

示例12: GetAll_Must_Return_All

        public void GetAll_Must_Return_All()
        {
            //
            // Arrange
            //

            var models = Enumerable.Range(1, 10).Select(x =>
            {
                var mockModel = new Mock<IModel>();
                mockModel.Setup(y => y.Id).Returns(x);

                return mockModel.Object;

            }).AsQueryable();

            var mockDbSet = new Mock<DbSet<IModel>>();
            mockDbSet.As<IQueryable<IModel>>().Setup(m => m.Provider).Returns(models.Provider);
            mockDbSet.As<IQueryable<IModel>>().Setup(m => m.Expression).Returns(models.Expression);
            mockDbSet.As<IQueryable<IModel>>().Setup(m => m.ElementType).Returns(models.ElementType);
            mockDbSet.As<IQueryable<IModel>>().Setup(m => m.GetEnumerator()).Returns(models.GetEnumerator());

            var mockContext = new Mock<EFDbContext>();

            mockContext.Setup(x => x.Set<IModel>()).Returns(mockDbSet.Object);

            var repository = new GenericRepository<IModel>(mockContext.Object);
            //
            // Act
            //
            var results = repository.GetAll();
            //
            // Assert
            //
            Assert.IsNotNull(results);
            Assert.IsNotNull(results.First());
            Assert.AreEqual(10, results.Count());
            Assert.AreEqual(1, results.First().Id);
        }
开发者ID:Cheranga,项目名称:DAL,代码行数:38,代码来源:GenericRepositoryTest.cs

示例13: TestMethod

        public void TestMethod()
        {
            var conn = new NHibernateConnection();
            var categories = new GenericRepository<Categories>(conn);
            List<Categories> list = categories.GetAll().ToList();
            int count = list.Count;
            //Test t = new Test
            //{
            //    LastName = "LastName",
            //    Name = "Name"
            //};

            //GenericRepository<Test> tRepo = new GenericRepository<Test>();
            //tRepo.Save(t);
        }
开发者ID:gpierzchala,项目名称:InternetStore,代码行数:15,代码来源:DataAccessTests.cs

示例14: GetPermissions

 public IHttpActionResult GetPermissions()
 {
     GenericRepository<MenuAccess> menuAccessRepository = new GenericRepository<MenuAccess>(new MyRoomDbContext());
     return Ok( menuAccessRepository.GetAll());
 }
开发者ID:jcvaldes,项目名称:MyRoomV7,代码行数:5,代码来源:PermissionsController.cs


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