本文整理汇总了C#中Schema.AddOrUpdateTable方法的典型用法代码示例。如果您正苦于以下问题:C# Schema.AddOrUpdateTable方法的具体用法?C# Schema.AddOrUpdateTable怎么用?C# Schema.AddOrUpdateTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Schema
的用法示例。
在下文中一共展示了Schema.AddOrUpdateTable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoCreate
/// <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)); });
}
示例2: DoCreate
/// <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));
}