本文整理汇总了C#中ITable.GetColumn方法的典型用法代码示例。如果您正苦于以下问题:C# ITable.GetColumn方法的具体用法?C# ITable.GetColumn怎么用?C# ITable.GetColumn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITable
的用法示例。
在下文中一共展示了ITable.GetColumn方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessComponent
private void ProcessComponent(component hComponent, Entity newEntity, ITable mappedTable, Dictionary<Class, ComponentSpecification> specifications, string hmNamespace, ParseResults parseResults)
{
if ([email protected] == null)
{
log.ErrorFormat("Could not load component named {0} on class {1} because it does not have a class attribute.", hComponent.name, newEntity.Name);
return;
}
var possibleClasses = GetPossibleClasses([email protected], hmNamespace, mappedTable.Schema, parseResults);
if (possibleClasses.Count == 0)
{
log.ErrorFormat("Could not load component named {0} on class {1} because we could not find the class named {2}.", hComponent.name, newEntity.Name, [email protected]);
return;
}
ComponentSpecification spec = null;
foreach (var possibleClass in possibleClasses)
{
spec = specifications.GetValueOrDefault(possibleClass);
if (spec != null)
break;
}
bool createProperties = false;
if (spec == null)
{
// Create a new spec from these.
spec = new ComponentSpecificationImpl(GetShortClassName([email protected]));
newEntity.EntitySet.AddComponentSpecification(spec);
createProperties = true;
}
Component component = spec.CreateImplementedComponentFor(newEntity, hComponent.name);
newEntity.Key.Component = component;
var mapping = new ComponentMappingImpl();
foreach (var prop in hComponent.Properties())
{
if (createProperties)
{
ComponentProperty idProperty = new ComponentPropertyImpl(prop.name);
idProperty.Type = prop.type1;
idProperty.ValidationOptions.MaximumLength = prop.length.As<int>();
SetPropertyInfoFromParsedCode(possibleClasses, idProperty);
spec.AddProperty(idProperty);
}
var compProperty = component.GetProperty(prop.name);
var column = mappedTable.GetColumn(prop.column.UnBackTick());
if (column == null)
{
// Create the column
column = entityProcessor.CreateColumn(compProperty.RepresentedProperty);
mapping.FromTable.AddColumn(column);
}
mapping.AddPropertyAndColumn(compProperty, column);
}
newEntity.EntitySet.MappingSet.AddMapping(mapping);
}
示例2: ProcessComponentKey
private bool ProcessComponentKey(compositeid hCompId, Entity newEntity, ITable mappedTable, Dictionary<Class, ComponentSpecification> specifications, string hmNamespace, ParseResults parseResults)
{
var possibleClasses = GetPossibleClasses([email protected], hmNamespace, mappedTable.Schema, parseResults);
if (possibleClasses.Count == 0) return false;
ComponentSpecification spec = null;
foreach (var possibleClass in possibleClasses)
{
spec = specifications.GetValueOrDefault(possibleClass);
if (spec != null)
break;
}
bool createProperties = false;
if (spec == null)
{
// Create a new spec from these.
spec = new ComponentSpecificationImpl(GetShortClassName([email protected]));
newEntity.EntitySet.AddComponentSpecification(spec);
createProperties = true;
}
Component component = spec.CreateImplementedComponentFor(newEntity, hCompId.name);
newEntity.Key.Component = component;
var mapping = new ComponentMappingImpl();
foreach (var prop in hCompId.KeyProperties())
{
if (createProperties)
{
ComponentProperty idProperty = new ComponentPropertyImpl(prop.name);
idProperty.Type = prop.type1;
idProperty.ValidationOptions.MaximumLength = prop.length.As<int>();
SetPropertyInfoFromParsedCode(possibleClasses, idProperty);
spec.AddProperty(idProperty);
}
var compProperty = component.GetProperty(prop.name);
var column = mappedTable.GetColumn(prop.column1.UnBackTick());
if (column == null)
{
// Create the column
column = entityProcessor.CreateColumn(compProperty.RepresentedProperty);
mapping.FromTable.AddColumn(column);
}
mapping.AddPropertyAndColumn(compProperty, column);
}
newEntity.EntitySet.MappingSet.AddMapping(mapping);
return true;
}