/// <summary> /// Creates the <see cref="Table"/> from the descriptor. /// </summary> /// <param name="context">The <see cref="IMansionContext"/>.</param> /// <param name="schema">The <see cref="Schema"/>in which to create the table.</param> /// <param name="property">The <see cref="IPropertyDefinition"/>.</param> protected override void DoCreate(IMansionContext context, Schema schema, IPropertyDefinition property) { var tableName = Properties.Get<string>(context, "tableName"); schema.AddOrUpdateTable(tableName, () => new SingleValuePropertyTable(tableName, property.Name), table => { throw new InvalidOperationException(string.Format("Single value property tables can only be used once, see {0}.{1}", TypeDefinition.Name, property.Name)); }); }
/// <summary> /// Creates the <see cref="Table"/> from the descriptor. /// </summary> /// <param name="context">The <see cref="IMansionContext"/>.</param> /// <param name="schema">The <see cref="Schema"/>in which to create the table.</param> /// <param name="property">The <see cref="IPropertyDefinition"/>.</param> protected override void DoCreate(IMansionContext context, Schema schema, IPropertyDefinition property) { var tableName = Properties.Get<string>(context, "tableName"); schema.AddOrUpdateTable(tableName, () => new MultiValuePropertyTable(tableName).Add(property.Name), table => table.Add(property.Name)); }