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


C# IDatabase.Insert方法代码示例

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


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

示例1: InsertEmployee

        private void InsertEmployee(Employee employee, IDatabase database)
        {

            Action proc = () =>
            {
                database.Insert(employee);

            };

            database.ExecuteInTransaction(proc);
        }
开发者ID:EasyExpress,项目名称:Easylink,代码行数:11,代码来源:NestedTransactionTest.cs

示例2: Entry

        public static bool Entry(IDatabase database, string cardId, ILane lane)
        {
            var time = DateTime.Now;
              var dailyDirectoryName = DailyDirectoryName(time);

              if (!Directory.Exists(dailyDirectoryName))
              {
            Directory.CreateDirectory(dailyDirectoryName);
              }

              var prefixFileName = dailyDirectoryName +
            Path.DirectorySeparatorChar +
            lane.Name.ToUpper() + time.ToString("HHmmss") + EntryString;

              var plateNumber = string.Empty;
              var plateFileName = string.Empty;
              var faceFileName = string.Empty;

              if (lane.PlateCamera != null)
              {
            plateFileName = prefixFileName + SuffixPlateFileName;
            if (!TakeAndSave(lane.PlateCamera, plateFileName))
            {
              // Error
            }

            // Todo: Get Plate number.
              }
              else
              {
            // Error
              }

              if (lane.FaceCamera != null)
              {
            faceFileName = prefixFileName + SuffixFaceFileName;
            if (!TakeAndSave(lane.FaceCamera, faceFileName))
            {
              faceFileName = string.Empty;
            }
              }

              if (CanEntry(database, cardId, plateNumber))
              {
            var paramater = new Dictionary<string, string>();
            paramater["CardId"] = cardId;
            paramater["EntryTime"] = time.ToString();
            paramater["EntryPlateNumber"] = plateNumber;
            paramater["EntryPlateImage"] = plateFileName.Remove(0, RootImageDirectoryName.Length);
            paramater["EntryFaceImage"] = faceFileName.Remove(0, RootImageDirectoryName.Length);

            return (database.Insert("EntryExit", paramater));
              }

              return (false);
        }
开发者ID:haivido,项目名称:Vido,代码行数:56,代码来源:Utilites.cs

示例3: Setup

        public void Setup()
        {
            db = TestDbHelper.GetEmptyDatabase();
            int currentFileId = 0;


            var qulityProfile = new QualityProfile
                                    {
                                        Name = "TestProfile",
                                        Allowed = new List<QualityTypes> { QualityTypes.DVD, QualityTypes.Bluray1080p },
                                        Cutoff = QualityTypes.DVD
                                    };
            db.Insert(qulityProfile);

            foreach (var _seriesId in seriesIds)
            {
                int seriesId = _seriesId;
                var series = Builder<Series>.CreateNew()
                    .With(s => s.SeriesId = seriesId)
                    .With(s => s.Monitored = true)
                    .Build();

                db.Insert(series);

                foreach (var _seasonNumber in seasonsNumbers)
                {
                    for (int i = 1; i <= Episodes_Per_Season; i++)
                    {
                        var epFileId = 0;

                        if (i < 10)
                        {
                            var epFile = Builder<EpisodeFile>.CreateNew()
                               .With(e => e.SeriesId = seriesId)
                                .And(e => e.SeasonNumber = _seasonNumber)
                               .And(e => e.Path = Guid.NewGuid().ToString())
                               .Build();

                            files.Add(epFile);

                            currentFileId++;
                            epFileId = currentFileId;

                        }


                        var episode = Builder<Episode>.CreateNew()
                            .With(e => e.SeriesId = seriesId)
                            .And(e => e.SeasonNumber = _seasonNumber)
                            .And(e => e.EpisodeNumber = i)
                            .And(e => e.Ignored = false)
                            .And(e => e.TvDbEpisodeId = episodes.Count + 1)
                            .And(e => e.EpisodeFileId = epFileId)
                            .And(e => e.AirDate = DateTime.Today.AddDays(-20))
                            .Build();

                        episodes.Add(episode);


                    }
                }

            }

            db.InsertMany(episodes);
            db.InsertMany(files);
        }
开发者ID:Normmatt,项目名称:NzbDrone,代码行数:67,代码来源:dbBenchmark.cs


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