示例#1
0
        public void Import(IEnumerable <QueuedRecipes> data)
        {
            using (var transaction = session.BeginTransaction())
            {
                var d = data.ToArray();
                foreach (var row in d)
                {
                    var dbRow = new Models.QueuedRecipes
                    {
                        QueueId    = row.QueueId,
                        UserId     = row.UserId,
                        Recipe     = Models.Recipes.FromId(row.RecipeId),
                        QueuedDate = row.QueuedDate
                    };

                    session.Save(dbRow, row.QueueId);
                }

                Log.DebugFormat("Created {0} row(s) in QueuedRecipes", d.Count());
                transaction.Commit();
                session.Flush();
            }
        }
        public void Import(IEnumerable<QueuedRecipes> data)
        {
            using (var transaction = this.session.BeginTransaction())
            {
                var queuedRecipesArray = data.ToArray();
                foreach (var queuedRecipes in queuedRecipesArray)
                {
                    var databaseQueuedRecipes = new Models.QueuedRecipes
                                              {
                                                  QueueId = queuedRecipes.QueueId,
                                                  UserId = queuedRecipes.UserId,
                                                  Recipe =
                                                      Models.Recipes.FromId(queuedRecipes.RecipeId),
                                                  QueuedDate = queuedRecipes.QueuedDate
                                              };

                    this.session.Save(databaseQueuedRecipes, queuedRecipes.QueueId);
                }

                this.Log.DebugFormat("Created {0} row(s) in QueuedRecipes", queuedRecipesArray.Count());
                transaction.Commit();
                this.session.Flush();
            }
        }
        public void Import(IEnumerable<QueuedRecipes> data)
        {
            using (var transaction = session.BeginTransaction())
             {
            var d = data.ToArray();
            foreach (var row in d)
            {
               var dbRow = new Models.QueuedRecipes
               {
                  QueueId = row.QueueId,
                  UserId = row.UserId,
                  Recipe = Models.Recipes.FromId(row.RecipeId),
                  QueuedDate = row.QueuedDate
               };

               session.Save(dbRow, row.QueueId);
            }

            Log.DebugFormat("Created {0} row(s) in QueuedRecipes", d.Count());
            transaction.Commit();
            session.Flush();
             }
        }