本文整理汇总了C#中StorageEntityContainerMapping.HasQueryViewForSetMap方法的典型用法代码示例。如果您正苦于以下问题:C# StorageEntityContainerMapping.HasQueryViewForSetMap方法的具体用法?C# StorageEntityContainerMapping.HasQueryViewForSetMap怎么用?C# StorageEntityContainerMapping.HasQueryViewForSetMap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StorageEntityContainerMapping
的用法示例。
在下文中一共展示了StorageEntityContainerMapping.HasQueryViewForSetMap方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HasQueryView
private static bool HasQueryView(StorageEntityContainerMapping storageEntityContainerMapping)
{
foreach (EntitySetBase extent in storageEntityContainerMapping.EdmEntityContainer.BaseEntitySets)
{
if (storageEntityContainerMapping.HasQueryViewForSetMap(extent.Name))
{
return true;
}
}
return false;
}
示例2: EnsureAllCSpaceContainerSetsAreMapped
// effects: Given a container, ensures that all entity/association
// sets in container on the C-side have been mapped
private static ErrorLog EnsureAllCSpaceContainerSetsAreMapped(IEnumerable<Cell> cells,
ConfigViewGenerator config,
StorageEntityContainerMapping containerMapping)
{
Set<EntitySetBase> mappedExtents = new Set<EntitySetBase>();
string mslFileLocation = null;
EntityContainer container = null;
// Determine the container and name of the file while determining
// the set of mapped extents in the cells
foreach (Cell cell in cells)
{
mappedExtents.Add(cell.CQuery.Extent);
mslFileLocation = cell.CellLabel.SourceLocation;
// All cells are from the same container
container = cell.CQuery.Extent.EntityContainer;
}
Debug.Assert(container != null);
List<EntitySetBase> missingExtents = new List<EntitySetBase>();
// Go through all the extents in the container and determine
// extents that are missing
foreach (EntitySetBase extent in container.BaseEntitySets)
{
if (mappedExtents.Contains(extent) == false
&& !(containerMapping.HasQueryViewForSetMap(extent.Name)))
{
AssociationSet associationSet = extent as AssociationSet;
if (associationSet==null || !associationSet.ElementType.IsForeignKey)
{
missingExtents.Add(extent);
}
}
}
ErrorLog errorLog = new ErrorLog();
// If any extent is not mapped, add an error
if (missingExtents.Count > 0)
{
StringBuilder extentBuilder = new StringBuilder();
bool isFirst = true;
foreach (EntitySetBase extent in missingExtents)
{
if (isFirst == false)
{
extentBuilder.Append(", ");
}
isFirst = false;
extentBuilder.Append(extent.Name);
}
string message = System.Data.Entity.Strings.ViewGen_Missing_Set_Mapping(extentBuilder);
// Find the cell with smallest line number - so that we can
// point to the beginning of the file
int lowestLineNum = -1;
Cell smallestCell = null;
foreach (Cell cell in cells)
{
if (lowestLineNum == -1 || cell.CellLabel.StartLineNumber < lowestLineNum)
{
smallestCell = cell;
lowestLineNum = cell.CellLabel.StartLineNumber;
}
}
Debug.Assert(smallestCell != null && lowestLineNum >= 0);
EdmSchemaError edmSchemaError = new EdmSchemaError(message, (int)ViewGenErrorCode.MissingExtentMapping,
EdmSchemaErrorSeverity.Error, containerMapping.SourceLocation, containerMapping.StartLineNumber,
containerMapping.StartLinePosition, null);
ErrorLog.Record record = new ErrorLog.Record(edmSchemaError);
errorLog.AddEntry(record);
}
return errorLog;
}