/// <summary>
 /// Puts new row into tabular data instance.
 /// </summary>
 /// <param name="data">Tabular data instance.</param>
 /// <param name="rowBuilderAction">Action used to build new row.</param>
 /// <returns>This tabular data instance.</returns>
 public static ITabularData Put(this ITabularData data, Action<ICompositeDataBuilder> rowBuilderAction)
 {
     if (data == null)
      {
     throw new ArgumentNullException("data");
      }
      if (rowBuilderAction == null)
      {
     throw new ArgumentNullException("rowBuilderAction");
      }
      CompositeDataBuilder rowBuilder = new CompositeDataBuilder(data.TabularType.RowType);
      rowBuilderAction(rowBuilder);
      data.Put(rowBuilder.Create());
      return data;
 }
Example #2
0
        /// <summary>
        /// Puts new row into tabular data instance.
        /// </summary>
        /// <param name="data">Tabular data instance.</param>
        /// <param name="rowBuilderAction">Action used to build new row.</param>
        /// <returns>This tabular data instance.</returns>
        public static ITabularData Put(this ITabularData data, Action <ICompositeDataBuilder> rowBuilderAction)
        {
            if (data == null)
            {
                throw new ArgumentNullException("data");
            }
            if (rowBuilderAction == null)
            {
                throw new ArgumentNullException("rowBuilderAction");
            }
            CompositeDataBuilder rowBuilder = new CompositeDataBuilder(data.TabularType.RowType);

            rowBuilderAction(rowBuilder);
            data.Put(rowBuilder.Create());
            return(data);
        }
 public ICompositeDataBuilder Composite(string name, Action<ICompositeDataBuilder> nestedCompositeValueBuilderAction)
 {
     if (name == null)
      {
     throw new ArgumentNullException("name");
      }
      if (nestedCompositeValueBuilderAction == null)
      {
     throw new ArgumentNullException("nestedCompositeValueBuilderAction");
      }
      CompositeType nestedCompositeType = _type.GetOpenType(name) as CompositeType;
      if (nestedCompositeType == null)
      {
     throw new InvalidOperationException(string.Format("Item {0} is not of CompositeType", name));
      }
      CompositeDataBuilder nestedBuilder = new CompositeDataBuilder(nestedCompositeType);
      nestedCompositeValueBuilderAction(nestedBuilder);
      _items.Add(name, nestedBuilder.Create());
      return this;
 }
Example #4
0
        public ICompositeDataBuilder Composite(string name, Action <ICompositeDataBuilder> nestedCompositeValueBuilderAction)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            if (nestedCompositeValueBuilderAction == null)
            {
                throw new ArgumentNullException("nestedCompositeValueBuilderAction");
            }
            CompositeType nestedCompositeType = _type.GetOpenType(name) as CompositeType;

            if (nestedCompositeType == null)
            {
                throw new InvalidOperationException(string.Format("Item {0} is not of CompositeType", name));
            }
            CompositeDataBuilder nestedBuilder = new CompositeDataBuilder(nestedCompositeType);

            nestedCompositeValueBuilderAction(nestedBuilder);
            _items.Add(name, nestedBuilder.Create());
            return(this);
        }