本文整理汇总了C#中System.Data.Metadata.Edm.EntitySetBase类的典型用法代码示例。如果您正苦于以下问题:C# EntitySetBase类的具体用法?C# EntitySetBase怎么用?C# EntitySetBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EntitySetBase类属于System.Data.Metadata.Edm命名空间,在下文中一共展示了EntitySetBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateGeneratedView
/// <summary>
/// Creates generated view object for the combination of the <paramref name="extent"/> and the <paramref name="type"/>.
/// This constructor is used for regular cell-based view generation.
/// </summary>
internal static GeneratedView CreateGeneratedView(EntitySetBase extent,
EdmType type,
DbQueryCommandTree commandTree,
string eSQL,
StorageMappingItemCollection mappingItemCollection,
ConfigViewGenerator config)
{
// If config.GenerateEsql is specified, eSQL must be non-null.
// If config.GenerateEsql is false, commandTree is non-null except the case when loading pre-compiled eSQL views.
Debug.Assert(!config.GenerateEsql || !String.IsNullOrEmpty(eSQL), "eSQL must be specified");
DiscriminatorMap discriminatorMap = null;
if (commandTree != null)
{
commandTree = ViewSimplifier.SimplifyView(extent, commandTree);
// See if the view matches the "discriminated" pattern (allows simplification of generated store commands)
if (extent.BuiltInTypeKind == BuiltInTypeKind.EntitySet)
{
if (DiscriminatorMap.TryCreateDiscriminatorMap((EntitySet)extent, commandTree.Query, out discriminatorMap))
{
Debug.Assert(discriminatorMap != null, "discriminatorMap == null after it has been created");
}
}
}
return new GeneratedView(extent, type, commandTree, eSQL, discriminatorMap, mappingItemCollection, config);
}
示例2: Create
/// <summary>
/// Recursively generates <see cref="MemberPath"/>s for the members of the types stored in the <paramref name="extent"/>.
/// </summary>
internal static MemberProjectionIndex Create(EntitySetBase extent, EdmItemCollection edmItemCollection)
{
// We generate the indices for the projected slots as we traverse the metadata.
MemberProjectionIndex index = new MemberProjectionIndex();
GatherPartialSignature(index, edmItemCollection, new MemberPath(extent), false); // need not only keys
return index;
}
示例3: StorageModificationFunctionMapping
internal StorageModificationFunctionMapping(
EntitySetBase entitySet,
EntityTypeBase entityType,
EdmFunction function,
IEnumerable<StorageModificationFunctionParameterBinding> parameterBindings,
FunctionParameter rowsAffectedParameter,
IEnumerable<StorageModificationFunctionResultBinding> resultBindings)
{
//Contract.Requires(entitySet != null);
//Contract.Requires(function != null);
//Contract.Requires(parameterBindings != null);
Function = function;
RowsAffectedParameter = rowsAffectedParameter;
ParameterBindings = parameterBindings.ToList().AsReadOnly();
if (null != resultBindings)
{
var bindings = resultBindings.ToList();
if (0 < bindings.Count)
{
ResultBindings = bindings.AsReadOnly();
}
}
CollocatedAssociationSetEnds =
GetReferencedAssociationSetEnds(entitySet as EntitySet, entityType as EntityType, parameterBindings)
.ToList()
.AsReadOnly();
}
示例4: TableMD
/// <summary>
/// Creates a "flattened" table definition.
///
/// The table has one column for each specified property in the "properties" parameter.
/// The name and datatype of each table column are taken from the corresponding property.
///
/// The keys of the table (if any) are those specified in the "keyProperties" parameter
///
/// The table may correspond to an entity set (if the entityset parameter was non-null)
/// </summary>
/// <param name="properties">prperties corresponding to columns of the table</param>
/// <param name="keyProperties"></param>
/// <param name="extent">entityset corresponding to the table (if any)</param>
internal TableMD(IEnumerable<EdmProperty> properties, IEnumerable<EdmMember> keyProperties,
EntitySetBase extent)
: this(extent)
{
Dictionary<string, ColumnMD> columnMap = new Dictionary<string, ColumnMD>();
m_flattened = true;
foreach (EdmProperty p in properties)
{
ColumnMD newColumn = new ColumnMD(this, p);
m_columns.Add(newColumn);
columnMap[p.Name] = newColumn;
}
foreach (EdmMember p in keyProperties)
{
ColumnMD keyColumn;
if (!columnMap.TryGetValue(p.Name, out keyColumn))
{
Debug.Assert(false, "keyMember not in columns?");
}
else
{
m_keys.Add(keyColumn);
}
}
}
示例5: CreateGeneratedViewForFKAssociationSet
/// <summary>
/// Creates generated view object for the combination of the <paramref name="extent"/> and the <paramref name="type"/>.
/// This constructor is used for FK association sets only.
/// </summary>
internal static GeneratedView CreateGeneratedViewForFKAssociationSet(EntitySetBase extent,
EdmType type,
DbQueryCommandTree commandTree,
StorageMappingItemCollection mappingItemCollection,
ConfigViewGenerator config)
{
return new GeneratedView(extent, type, commandTree, null, null, mappingItemCollection, config);
}
示例6: GetMappingsForEntitySetAndSuperTypes
/// <summary>
/// Returns all mapping fragments for the given entity set's types and their parent types.
/// </summary>
internal static IEnumerable<StorageTypeMapping> GetMappingsForEntitySetAndSuperTypes(StorageMappingItemCollection mappingCollection, EntityContainer container, EntitySetBase entitySet, EntityTypeBase childEntityType)
{
return MetadataHelper.GetTypeAndParentTypesOf(childEntityType, mappingCollection.EdmItemCollection, true /*includeAbstractTypes*/).SelectMany(
edmType =>
edmType.EdmEquals(childEntityType) ?
GetMappingsForEntitySetAndType(mappingCollection, container, entitySet, (edmType as EntityTypeBase))
: GetIsTypeOfMappingsForEntitySetAndType(mappingCollection, container, entitySet, (edmType as EntityTypeBase), childEntityType)
).ToList();
}
示例7: RelationshipChange
public RelationshipChange(EntityKey sourceKey, EntityKey targetKey, object source, object target, EntitySetBase entitySet, EntityState state)
{
_sourceKey = sourceKey;
_targetKey = targetKey;
_source = source;
_target = target;
_entitySet = entitySet;
_state = state;
}
示例8: GetIsTypeOfMappingsForEntitySetAndType
/// <summary>
/// Returns mappings for the given set/type only if the mapping applies also to childEntittyType either via IsTypeOf or explicitly specifying multiple types in mapping fragments.
/// </summary>
private static IEnumerable<StorageTypeMapping> GetIsTypeOfMappingsForEntitySetAndType(StorageMappingItemCollection mappingCollection, EntityContainer container, EntitySetBase entitySet, EntityTypeBase entityType, EntityTypeBase childEntityType)
{
foreach (var mapping in GetMappingsForEntitySetAndType(mappingCollection, container, entitySet, entityType))
{
if (mapping.IsOfTypes.Any(parentType => parentType.IsAssignableFrom(childEntityType)) || mapping.Types.Contains(childEntityType))
{
yield return mapping;
}
}
}
示例9: ExtentCqlBlock
/// <summary>
/// Creates an cql block representing the <paramref name="extent"/> (the FROM part).
/// SELECT is given by <paramref name="slots"/>, WHERE by <paramref name="whereClause"/> and AS by <paramref name="blockAliasNum"/>.
/// </summary>
internal ExtentCqlBlock(EntitySetBase extent,
CellQuery.SelectDistinct selectDistinct,
SlotInfo[] slots,
BoolExpression whereClause,
CqlIdentifiers identifiers,
int blockAliasNum)
: base(slots, EmptyChildren, whereClause, identifiers, blockAliasNum)
{
m_extent = extent;
m_nodeTableAlias = identifiers.GetBlockAlias();
m_selectDistinct = selectDistinct;
}
示例10: GetMappingsForEntitySetAndType
internal static IEnumerable<StorageTypeMapping> GetMappingsForEntitySetAndType(StorageMappingItemCollection mappingCollection, EntityContainer container, EntitySetBase entitySet, EntityTypeBase entityType)
{
Debug.Assert(entityType != null, "EntityType parameter should not be null.");
StorageEntityContainerMapping containerMapping = GetEntityContainerMap(mappingCollection, container);
StorageSetMapping extentMap = containerMapping.GetSetMapping(entitySet.Name);
//The Set may have no mapping
if (extentMap != null)
{
//for each mapping fragment of Type we are interested in within the given set
//Check use of IsOfTypes in Code review
foreach (StorageTypeMapping typeMap in extentMap.TypeMappings.Where(map => map.Types.Union(map.IsOfTypes).Contains(entityType)))
{
yield return typeMap;
}
}
}
示例11: Visit
protected virtual void Visit(EntitySetBase entitySetBase)
{
// this is a switching node, so no object header and footer will be add for this node,
// also this Visit won't add the object to the seen list
switch (entitySetBase.BuiltInTypeKind)
{
case BuiltInTypeKind.EntitySet:
Visit((EntitySet)entitySetBase);
break;
case BuiltInTypeKind.AssociationSet:
Visit((AssociationSet)entitySetBase);
break;
default:
Debug.Fail(string.Format(CultureInfo.InvariantCulture, "Found type '{0}', did we add a new type?", entitySetBase.BuiltInTypeKind));
break;
}
}
示例12: GetModificationFunctionMappingsForEntitySetAndType
internal static IEnumerable<StorageEntityTypeModificationFunctionMapping> GetModificationFunctionMappingsForEntitySetAndType(StorageMappingItemCollection mappingCollection, EntityContainer container, EntitySetBase entitySet, EntityTypeBase entityType)
{
StorageEntityContainerMapping containerMapping = GetEntityContainerMap(mappingCollection, container);
StorageSetMapping extentMap = containerMapping.GetSetMapping(entitySet.Name);
StorageEntitySetMapping entitySetMapping = extentMap as StorageEntitySetMapping;
//The Set may have no mapping
if (entitySetMapping != null)
{
if (entitySetMapping != null) //could be association set mapping
{
foreach (var v in entitySetMapping.ModificationFunctionMappings.Where(functionMap => functionMap.EntityType.Equals(entityType)))
{
yield return v;
}
}
}
}
示例13: GetWrappersFromContext
private static List<LeftCellWrapper> GetWrappersFromContext(ViewgenContext context, EntitySetBase extent)
{
List<LeftCellWrapper> wrappers;
if (context == null)
{
wrappers = new List<LeftCellWrapper>();
}
else
{
Debug.Assert(context.Extent.Equals(extent), "ViewgenContext extent and expected extent different");
wrappers = context.AllWrappersForExtent;
}
return wrappers;
}
示例14: BuildRelPropertyExpression
private Node BuildRelPropertyExpression(
EntitySetBase entitySet, RelProperty relProperty,
Node keyExpr)
{
//
// Make a copy of the current key expression
//
keyExpr = OpCopier.Copy(m_command, keyExpr);
//
// Find the relationship set corresponding to this entityset (and relProperty)
// Return a null ref, if we can't find one
//
var relSet = FindRelationshipSet(entitySet, relProperty);
if (relSet == null)
{
return m_command.CreateNode(m_command.CreateNullOp(relProperty.ToEnd.TypeUsage));
}
var scanTableOp = m_command.CreateScanTableOp(Command.CreateTableDefinition(relSet));
PlanCompiler.Assert(
scanTableOp.Table.Columns.Count == 1,
"Unexpected column count for table:" + scanTableOp.Table.TableMetadata.Extent + "=" + scanTableOp.Table.Columns.Count);
var scanTableVar = scanTableOp.Table.Columns[0];
var scanNode = m_command.CreateNode(scanTableOp);
var sourceEndNode = m_command.CreateNode(
m_command.CreatePropertyOp(relProperty.FromEnd),
m_command.CreateNode(m_command.CreateVarRefOp(scanTableVar)));
var predicateNode = m_command.BuildComparison(
OpType.EQ,
keyExpr,
m_command.CreateNode(m_command.CreateGetRefKeyOp(keyExpr.Op.Type), sourceEndNode));
var filterNode = m_command.CreateNode(
m_command.CreateFilterOp(),
scanNode, predicateNode);
//
// Process the node, and then add this as a subquery to the parent relop
//
var ret = VisitNode(filterNode);
ret = AddSubqueryToParentRelOp(scanTableVar, ret);
//
// Now extract out the target end property
//
ret = m_command.CreateNode(
m_command.CreatePropertyOp(relProperty.ToEnd),
ret);
return ret;
}
示例15: GetExtentFullName
private static string GetExtentFullName(EntitySetBase entitySet)
{
//We store the full Extent Name in the generated code which is
//EntityContainer name + "." + entitysetName
return entitySet.EntityContainer.Name + EntityViewGenerationConstants.QualificationCharacter + entitySet.Name;
}