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


C# RepositoryFactory.CreateEntityRepository方法代码示例

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


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

示例1: OnAddNewStop

        private void OnAddNewStop(object sender, EventArgs e)
        {
            using (AddNewProductionStopForm form = new AddNewProductionStopForm())
            {
                if (form.ShowDialog(this) == DialogResult.OK)
                {
                    ProductionStop newStop = new ProductionStop(form.ProductionStopName);
                    using (RepositoryFactory factory = new RepositoryFactory())
                    {
                        using (IEntityRepository<ProductionStop> repository = factory.CreateEntityRepository<ProductionStop>())
                        {
                            repository.Save(newStop);
                        }

                        using (var repository = factory.CreateEntityRepository<MachineConfiguration>())
                        {
                            foreach (var machine in repository.LoadAll())
                            {
                                List<ProductionStop> stops = new List<ProductionStop>(machine.AvailableProductionStops);
                                stops.Add(newStop);
                                machine.AvailableProductionStops = stops;

                                repository.Save(machine);
                            }
                        }

                        Load();
                    }
                }
            }
        }
开发者ID:mikkela,项目名称:oee,代码行数:31,代码来源:MachineConfigurationUserControl.cs

示例2: btnUpdateBaseCost_Click

        private void btnUpdateBaseCost_Click(object sender, EventArgs e)
        {
            using (RepositoryFactory factory = new RepositoryFactory())
            {
                using (
                    IEntityRepository<MachineConfiguration> repository =
                        factory.CreateEntityRepository<MachineConfiguration>())
                {
                    List<MachineConfiguration> machines = new List<MachineConfiguration>(repository.LoadAll());

                    using (BaseCostForm form = new BaseCostForm())
                    {
                        form.Machines = machines;
                        if (form.ShowDialog(this) == DialogResult.OK)
                        {
                            foreach (var machine in machines)
                            {
                                repository.Save(machine);
                            }
                            LoadData(machines);
                        }
                    }
                }

            }
        }
开发者ID:mikkela,项目名称:oee,代码行数:26,代码来源:MainForm.cs

示例3: LoadMachineConfiguration

 private MachineConfiguration LoadMachineConfiguration()
 {
     using (RepositoryFactory factory = new RepositoryFactory())
     {
         using (IEntityRepository<MachineConfiguration> repository = factory.CreateEntityRepository<MachineConfiguration>())
         {
             return new List<MachineConfiguration>(repository.LoadAll())[0];
         }
     }
 }
开发者ID:mikkela,项目名称:oee,代码行数:10,代码来源:MachineConfigurationUserControl.cs

示例4: GetProductionStops

 private IEnumerable<ProductionStop> GetProductionStops()
 {
     using (RepositoryFactory factory = new RepositoryFactory())
     {
         using (IEntityRepository<ProductionStop> repository = factory.CreateEntityRepository<ProductionStop>())
         {
             return repository.LoadAll();
         }
     }
 }
开发者ID:mikkela,项目名称:oee,代码行数:10,代码来源:GenerateReportForm.cs

示例5: AddTwoProductionStopsWithSameProductionStopName

        public void AddTwoProductionStopsWithSameProductionStopName()
        {
            RepositoryFactory factory = new RepositoryFactory();;
            ProductionStop productionStop1 = new ProductionStop("Alarm", true);
            ProductionStop productionStop2 = new ProductionStop("Alarm", false);

            using (IEntityRepository<ProductionStop> repository = factory.CreateEntityRepository<ProductionStop>())
            {
                repository.Save(productionStop1);
                repository.Save(productionStop2);
            }
        }
开发者ID:mikkela,项目名称:oee,代码行数:12,代码来源:ProductionStopRepositoryTest.cs

示例6: AddTwoProductionTeamsWithSameProductionTeamName

        public void AddTwoProductionTeamsWithSameProductionTeamName()
        {
            RepositoryFactory factory = new RepositoryFactory();;
            ProductionTeam productionTeam1 = new ProductionTeam("Team A");
            ProductionTeam productionTeam2 = new ProductionTeam("Team A");

            using (IEntityRepository<ProductionTeam> repository = factory.CreateEntityRepository<ProductionTeam>())
            {
                repository.Save(productionTeam1);
                repository.Save(productionTeam2);
            }
        }
开发者ID:mikkela,项目名称:oee,代码行数:12,代码来源:ProductionTeamRepositoryTest.cs

示例7: AddNewProductionStops

        public void AddNewProductionStops()
        {
            RepositoryFactory factory = new RepositoryFactory();;
            ProductionStop productionStop1 = new ProductionStop("Alarm");
            ProductionStop productionStop2 = new ProductionStop("Warning");

            using (IEntityRepository<ProductionStop> repository = factory.CreateEntityRepository<ProductionStop>())
            {
                repository.Save(productionStop1);
                repository.Save(productionStop2);
            }

            Assert.AreNotEqual(productionStop1.Id, productionStop2.Id);
        }
开发者ID:mikkela,项目名称:oee,代码行数:14,代码来源:ProductionStopRepositoryTest.cs

示例8: AddNewProductionTeams

        public void AddNewProductionTeams()
        {
            RepositoryFactory factory = new RepositoryFactory();
            ProductionTeam productionTeam1 = new ProductionTeam("Team A");
            ProductionTeam productionTeam2 = new ProductionTeam("Team B");

            using (IEntityRepository<ProductionTeam> repository = factory.CreateEntityRepository<ProductionTeam>())
            {
                repository.Save(productionTeam1);
                repository.Save(productionTeam2);
            }

            Assert.AreNotEqual(productionTeam1.Id, productionTeam2.Id);
        }
开发者ID:mikkela,项目名称:oee,代码行数:14,代码来源:ProductionTeamRepositoryTest.cs

示例9: LoadOrderNumber

        private string LoadOrderNumber(long productionId)
        {
            using (RepositoryFactory factory = new RepositoryFactory())
            {
                using (IEntityRepository<Production> repository = factory.CreateEntityRepository<Production>())
                {
                    Production p = repository.Load(productionId);
                    if (p != null)
                        return p.Order.Number;
                }
            }

            return "";
        }
开发者ID:mikkela,项目名称:oee,代码行数:14,代码来源:UseExistingProductionForm.cs

示例10: LoadData

        public void LoadData()
        {
            using (RepositoryFactory factory = new RepositoryFactory())
            {
                clbMachines.Items.Clear();

                using (IEntityRepository<MachineConfiguration> repository = factory.CreateEntityRepository<MachineConfiguration>())
                {
                    foreach (var machineConfiguration in repository.LoadAll())
                    {
                        clbMachines.Items.Add(machineConfiguration.MachineName);
                    }
                }

                clbTeam.Items.Clear();
                using (IEntityRepository<ProductionTeam> repository = factory.CreateEntityRepository<ProductionTeam>())
                {
                    foreach (var team in repository.LoadAll())
                    {
                        clbTeam.Items.Add(new TeamItem(team));
                    }
                }
            }
        }
开发者ID:mikkela,项目名称:oee,代码行数:24,代码来源:UCFilter.cs

示例11: AddNewProductionStop

        public void AddNewProductionStop()
        {
            RepositoryFactory factory = new RepositoryFactory();;
            ProductionStop productionStop = new ProductionStop("Alarm");

            Assert.AreEqual(0, productionStop.Id);
            Assert.AreEqual(0, productionStop.Version);

            using (IEntityRepository<ProductionStop> repository = factory.CreateEntityRepository<ProductionStop>())
            {
                repository.Save(productionStop);
            }

            Assert.AreNotEqual(0, productionStop.Id);
            Assert.AreNotEqual(0, productionStop.Version);
        }
开发者ID:mikkela,项目名称:oee,代码行数:16,代码来源:ProductionStopRepositoryTest.cs

示例12: AddNewProductionTeam

        public void AddNewProductionTeam()
        {
            RepositoryFactory factory = new RepositoryFactory();
            ProductionTeam productionTeam = new ProductionTeam("Team A");

            Assert.AreEqual(0, productionTeam.Id);
            Assert.AreEqual(0, productionTeam.Version);

            using (IEntityRepository<ProductionTeam> repository = factory.CreateEntityRepository<ProductionTeam>())
            {
                repository.Save(productionTeam);
            }

            Assert.AreNotEqual(0, productionTeam.Id);
            Assert.AreNotEqual(0, productionTeam.Version);
        }
开发者ID:mikkela,项目名称:oee,代码行数:16,代码来源:ProductionTeamRepositoryTest.cs

示例13: DeleteProductionStops

        public void DeleteProductionStops()
        {
            RepositoryFactory factory = new RepositoryFactory(); ;
            ProductionStop productionStop1 = new ProductionStop("Alarm");
            ProductionStop productionStop2 = new ProductionStop("Warning");

            using (IEntityRepository<ProductionStop> repository = factory.CreateEntityRepository<ProductionStop>())
            {
                repository.Save(productionStop1);
                repository.Save(productionStop2);
            }

            List<ProductionStop> list = null;
            using (IEntityRepository<ProductionStop> repository = factory.CreateEntityRepository<ProductionStop>())
            {
                list = new List<ProductionStop>(repository.LoadAll());
            }
            CollectionAssert.AreEquivalent(new ProductionStop[] { productionStop1, productionStop2 }, list);

            using (IEntityRepository<ProductionStop> repository = factory.CreateEntityRepository<ProductionStop>())
            {
                repository.Delete(productionStop2);
            }
            using (IEntityRepository<ProductionStop> repository = factory.CreateEntityRepository<ProductionStop>())
            {
                list = new List<ProductionStop>(repository.LoadAll());
            }
            CollectionAssert.AreEquivalent(new ProductionStop[] { productionStop1 }, list);

            using (IEntityRepository<ProductionStop> repository = factory.CreateEntityRepository<ProductionStop>())
            {
                repository.Delete(productionStop1);
            }
            using (IEntityRepository<ProductionStop> repository = factory.CreateEntityRepository<ProductionStop>())
            {
                list = new List<ProductionStop>(repository.LoadAll());
            }
            CollectionAssert.AreEquivalent(new ProductionStop[] { }, list);
        }
开发者ID:mikkela,项目名称:oee,代码行数:39,代码来源:ProductionStopRepositoryTest.cs

示例14: DeleteProductionTeams

        public void DeleteProductionTeams()
        {
            RepositoryFactory factory = new RepositoryFactory();
            ProductionTeam productionTeam1 = new ProductionTeam("Team A");
            ProductionTeam productionTeam2 = new ProductionTeam("Team B");

            using (IEntityRepository<ProductionTeam> repository = factory.CreateEntityRepository<ProductionTeam>())
            {
                repository.Save(productionTeam1);
                repository.Save(productionTeam2);
            }

            List<ProductionTeam> list = null;
            using (IEntityRepository<ProductionTeam> repository = factory.CreateEntityRepository<ProductionTeam>())
            {
                list = new List<ProductionTeam>(repository.LoadAll());
            }
            CollectionAssert.AreEquivalent(new ProductionTeam[] { productionTeam1, productionTeam2 }, list);

            using (IEntityRepository<ProductionTeam> repository = factory.CreateEntityRepository<ProductionTeam>())
            {
                repository.Delete(productionTeam2);
            }
            using (IEntityRepository<ProductionTeam> repository = factory.CreateEntityRepository<ProductionTeam>())
            {
                list = new List<ProductionTeam>(repository.LoadAll());
            }
            CollectionAssert.AreEquivalent(new ProductionTeam[] { productionTeam1 }, list);

            using (IEntityRepository<ProductionTeam> repository = factory.CreateEntityRepository<ProductionTeam>())
            {
                repository.Delete(productionTeam1);
            }
            using (IEntityRepository<ProductionTeam> repository = factory.CreateEntityRepository<ProductionTeam>())
            {
                list = new List<ProductionTeam>(repository.LoadAll());
            }
            CollectionAssert.AreEquivalent(new ProductionTeam[] { }, list);
        }
开发者ID:mikkela,项目名称:oee,代码行数:39,代码来源:ProductionTeamRepositoryTest.cs

示例15: SetUp

        public void SetUp()
        {
            factory = new RepositoryFactory();;

            productionStop1 = new ProductionStop("Stop A");
            productionStop2 = new ProductionStop("Stop B");

            using (IEntityRepository<ProductionStop> repository = factory.CreateEntityRepository<ProductionStop>())
            {
                repository.Save(productionStop1);
                repository.Save(productionStop2);
            }
        }
开发者ID:mikkela,项目名称:oee,代码行数:13,代码来源:MachineConfigurationRepositoryTest.cs


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