本文整理汇总了C#中StorageEntityContainerMapping.HasMappingFragments方法的典型用法代码示例。如果您正苦于以下问题:C# StorageEntityContainerMapping.HasMappingFragments方法的具体用法?C# StorageEntityContainerMapping.HasMappingFragments怎么用?C# StorageEntityContainerMapping.HasMappingFragments使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StorageEntityContainerMapping
的用法示例。
在下文中一共展示了StorageEntityContainerMapping.HasMappingFragments方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenerateEntitySetViews
internal static void GenerateEntitySetViews(
StorageEntityContainerMapping entityContainerMapping,
Dictionary<EntitySetBase, string> esqlViews,
IList<EdmSchemaError> errors)
{
Debug.Assert(entityContainerMapping.HasViews);
// If entityContainerMapping contains only query views, then add a warning to the errors and continue to next mapping.
if (!entityContainerMapping.HasMappingFragments())
{
Debug.Assert(
2088 == (int)StorageMappingErrorCode.MappingAllQueryViewAtCompileTime,
"Please change the ERRORCODE_MAPPINGALLQUERYVIEWATCOMPILETIME value as well");
errors.Add(
new EdmSchemaError(
Strings.Mapping_AllQueryViewAtCompileTime(entityContainerMapping.Identity),
(int)StorageMappingErrorCode.MappingAllQueryViewAtCompileTime,
EdmSchemaErrorSeverity.Warning));
}
else
{
var viewGenResults = ViewgenGatekeeper.GenerateViewsFromMapping(
entityContainerMapping, new ConfigViewGenerator
{
GenerateEsql = true
});
if (viewGenResults.HasErrors)
{
((List<EdmSchemaError>)errors).AddRange(viewGenResults.Errors);
}
var extentMappingViews = viewGenResults.Views;
foreach (var extentViewPair in extentMappingViews.KeyValuePairs)
{
var generatedViews = extentViewPair.Value;
// Multiple Views are returned for an extent but the first view
// is the only one that we will use for now. In the future,
// we might start using the other views which are per type within an extent.
esqlViews.Add(extentViewPair.Key, generatedViews[0].eSQL);
}
}
}
示例2: GenerateViews
internal static Dictionary<EntitySetBase, DbMappingView> GenerateViews(
StorageEntityContainerMapping containerMapping, IList<EdmSchemaError> errors)
{
var views = new Dictionary<EntitySetBase, DbMappingView>();
if (!containerMapping.HasViews)
{
return views;
}
// If the entity container mapping has only query views, add a warning and return.
if (!containerMapping.HasMappingFragments())
{
Debug.Assert(
2088 == (int)StorageMappingErrorCode.MappingAllQueryViewAtCompileTime,
"Please change the ERRORCODE_MAPPINGALLQUERYVIEWATCOMPILETIME value as well.");
errors.Add(
new EdmSchemaError(
Strings.Mapping_AllQueryViewAtCompileTime(containerMapping.Identity),
(int)StorageMappingErrorCode.MappingAllQueryViewAtCompileTime,
EdmSchemaErrorSeverity.Warning));
return views;
}
var viewGenResults = ViewgenGatekeeper.GenerateViewsFromMapping(
containerMapping, new ConfigViewGenerator { GenerateEsql = true });
if (viewGenResults.HasErrors)
{
viewGenResults.Errors.Each(e => errors.Add(e));
}
foreach (var extentViewPair in viewGenResults.Views.KeyValuePairs)
{
// Multiple views are returned for an extent but the first view is
// the only one that we will use for now. In the future, we might
// start using the other views which are per type within an extent.
views.Add(extentViewPair.Key, new DbMappingView(extentViewPair.Value[0].eSQL));
}
return views;
}