public ForEachFederationExpressionBuilder(IMigrationContext context, ForEachFederationExpression expression)
 {
     _expression = expression;
      expression.Context = new MigrationContext (context.Conventions, context.QuerySchema,
                                             context.MigrationAssembly,
                                             context.ApplicationContext);
 }
 public override string Generate(ForEachFederationExpression expression)
 {
     throw new NotSupportedException("Currently only Azure databases support data federation.");
 }
        public void Process(ForEachFederationExpression expression)
        {
            UseFederationExpression useRootFederation = new UseFederationExpression {UseRoot = true};
               Process (useRootFederation);

               DataTable federations = Read(m_forEachFederationSql, expression.Federation).Tables[0];

               foreach (DataRow row in federations.Rows)
               {
              string range = row["range_low"].ToString();
              string distribution = row["distribution_name"].ToString();

              UseFederationExpression useFederationExpression = new UseFederationExpression
              {
                 DistributionName = distribution,
                 Name = expression.Federation,
                 DistributionValue = range
              };
              Process(useFederationExpression);

              foreach (IMigrationExpression innerExpression in  expression.Context.Expressions)
              {
                 innerExpression.ExecuteWith (this);
              }
               }
        }
 public IForEachFederationExpressionBuilder Federation(string name)
 {
     var expression = new ForEachFederationExpression{Federation = name};
     _context.Expressions.Add(expression);
     return new ForEachFederationExpressionBuilder(_context, expression);
 }