本文整理汇总了C#中MetadataWorkspace.GetObjectSpaceType方法的典型用法代码示例。如果您正苦于以下问题:C# MetadataWorkspace.GetObjectSpaceType方法的具体用法?C# MetadataWorkspace.GetObjectSpaceType怎么用?C# MetadataWorkspace.GetObjectSpaceType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MetadataWorkspace
的用法示例。
在下文中一共展示了MetadataWorkspace.GetObjectSpaceType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateEntityType
private static IEdmEntityType CreateEntityType(
MetadataWorkspace efModel,
EntityType efEntityType,
EdmModel model,
IDictionary<MetadataItem, IEdmElement> elementMap,
out List<EdmStructuralProperty> concurrencyProperties)
{
// TODO GitHubIssue#36 : support complex and entity inheritance
var objectSpaceType = efModel.GetObjectSpaceType(efEntityType) as EntityType;
var entityType = new EdmEntityType(objectSpaceType.NamespaceName, objectSpaceType.Name);
concurrencyProperties = null;
foreach (var efProperty in efEntityType.Properties)
{
var type = GetTypeReference(efProperty, model, elementMap);
if (type != null)
{
string defaultValue = null;
if (efProperty.DefaultValue != null)
{
defaultValue = efProperty.DefaultValue.ToString();
}
var property = entityType.AddStructuralProperty(
efProperty.Name,
type,
defaultValue,
EdmConcurrencyMode.None); // alway None:replaced by OptimisticConcurrency annotation
MetadataProperty storeGeneratedPattern = null;
efProperty.MetadataProperties.TryGetValue(
AnnotationSchema + StoreGeneratedPatternKey,
true,
out storeGeneratedPattern);
if (storeGeneratedPattern != null &&
(string)storeGeneratedPattern.Value == StoreGeneratedPatternValueComputed)
{
SetComputedAnnotation(model, property);
}
if (efProperty.ConcurrencyMode == ConcurrencyMode.Fixed)
{
concurrencyProperties = concurrencyProperties ?? new List<EdmStructuralProperty>();
concurrencyProperties.Add(property);
}
}
}
entityType.AddKeys(efEntityType.KeyProperties
.Select(p => entityType.FindProperty(p.Name))
.Cast<IEdmStructuralProperty>());
return entityType;
}