本文整理汇总了C#中System.Data.Metadata.Edm.EdmMember类的典型用法代码示例。如果您正苦于以下问题:C# EdmMember类的具体用法?C# EdmMember怎么用?C# EdmMember使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EdmMember类属于System.Data.Metadata.Edm命名空间,在下文中一共展示了EdmMember类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TryGetMember
/// <summary>
/// Given the type in the target space and the member name in the source space,
/// get the corresponding member in the target space
/// For e.g. consider a Conceptual Type 'Foo' with a member 'Bar' and a CLR type
/// 'XFoo' with a member 'YBar'. If one has a reference to Foo one can
/// invoke GetMember(Foo,"YBar") to retrieve the member metadata for bar
/// </summary>
/// <param name="type">The type in the target perspective</param>
/// <param name="memberName">the name of the member in the source perspective</param>
/// <param name="ignoreCase">Whether to do case-sensitive member look up or not</param>
/// <param name="outMember">returns the member in target space, if a match is found</param>
internal virtual bool TryGetMember(StructuralType type, String memberName, bool ignoreCase, out EdmMember outMember)
{
EntityUtil.CheckArgumentNull(type, "type");
EntityUtil.CheckStringArgument(memberName, "memberName");
outMember = null;
return type.Members.TryGetValue(memberName, ignoreCase, out outMember);
}
示例2: LinqToEntitiesTypeDescriptor
/// <summary>
/// Constructor taking a metadata context, an structural type, and a parent custom type descriptor
/// </summary>
/// <param name="typeDescriptionContext">The <see cref="LinqToEntitiesTypeDescriptionContext"/> context.</param>
/// <param name="edmType">The <see cref="StructuralType"/> type (can be an entity or complex type).</param>
/// <param name="parent">The parent custom type descriptor.</param>
public LinqToEntitiesTypeDescriptor(LinqToEntitiesTypeDescriptionContext typeDescriptionContext, StructuralType edmType, ICustomTypeDescriptor parent)
: base(parent)
{
_typeDescriptionContext = typeDescriptionContext;
_edmType = edmType;
EdmMember[] timestampMembers = _edmType.Members.Where(p => ObjectContextUtilities.IsConcurrencyTimestamp(p)).ToArray();
if (timestampMembers.Length == 1)
{
_timestampMember = timestampMembers[0];
}
if (edmType.BuiltInTypeKind == BuiltInTypeKind.EntityType)
{
// if any FK member of any association is also part of the primary key, then the key cannot be marked
// Editable(false)
EntityType entityType = (EntityType)edmType;
_foreignKeyMembers = new HashSet<EdmMember>(entityType.NavigationProperties.SelectMany(p => p.GetDependentProperties()));
foreach (EdmProperty foreignKeyMember in _foreignKeyMembers)
{
if (entityType.KeyMembers.Contains(foreignKeyMember))
{
_keyIsEditable = true;
break;
}
}
}
}
示例3: EdmColumnProvider
public EdmColumnProvider(EntityType entityType, EdmTableProvider table, EdmMember m, bool isPrimaryKey, bool supportPagingAndSorting)
: base(table)
{
EdmMember = m;
IsPrimaryKey = isPrimaryKey;
_table = table;
_supportSorting = supportPagingAndSorting;
MaxLength = 0;
Name = EdmMember.Name;
// REVIEW Seems like extra properties added in partial classes are not even detected by the metadata engine
IsCustomProperty = false;
// REVIEW: This should probably be a debug assert or we should only pass an EmdProperty
var property = EdmMember as EdmProperty;
if (property != null) {
IsForeignKeyComponent = DetermineIsForeignKeyComponent(property);
IsGenerated = IsServerGenerated(property);
}
ProcessFacets();
var navProp = m as NavigationProperty;
if (navProp != null) {
_isAssociation = true;
long key = EdmAssociationProvider.BuildRelationshipKey(entityType, navProp.FromEndMember);
((EdmDataModelProvider)table.DataModel).RelationshipEndLookup[key] = this;
}
}
示例4: TryGetSetterExpression
// effects: try to find setter expression for the given member
// requires: command tree must be an insert or update tree (since other DML trees hnabve
private static bool TryGetSetterExpression(DbModificationCommandTree tree, EdmMember member, ModificationOperator op, out DbSetClause setter)
{
Debug.Assert(op == ModificationOperator.Insert || op == ModificationOperator.Update, "only inserts and updates have setters");
IEnumerable<DbModificationClause> clauses;
if (ModificationOperator.Insert == op)
{
clauses = ((DbInsertCommandTree)tree).SetClauses;
}
else
{
clauses = ((DbUpdateCommandTree)tree).SetClauses;
}
foreach (DbSetClause setClause in clauses)
{
// check if this is the correct setter
if (((DbPropertyExpression)setClause.Property).Property.EdmEquals(member))
{
setter = setClause;
return true;
}
}
// no match found
setter = null;
return false;
}
示例5: EFColumnProvider
public EFColumnProvider(EntityType entityType, EFTableProvider table, EdmMember m, bool isPrimaryKey)
: base(table) {
EdmMember = m;
IsPrimaryKey = isPrimaryKey;
_table = table;
MaxLength = 0;
Name = EdmMember.Name;
//
IsCustomProperty = false;
//
var property = EdmMember as EdmProperty;
if (property != null) {
IsForeignKeyComponent = DetermineIsForeignKeyComponent(property);
IsGenerated = IsServerGenerated(property);
}
ProcessFacets();
var navProp = m as NavigationProperty;
if (navProp != null) {
_isAssociation = true;
long key = EFAssociationProvider.BuildRelationshipKey(entityType, navProp.FromEndMember);
((EFDataModelProvider)table.DataModel).RelationshipEndLookup[key] = this;
}
}
示例6: EntityProxyMemberInfo
internal EntityProxyMemberInfo(EdmMember member, int propertyIndex)
{
Debug.Assert(member != null, "member must be non-null");
Debug.Assert(propertyIndex > -1, "propertyIndex must be non-negative");
_member = member;
_propertyIndex = propertyIndex;
}
示例7: ForProperty
/// <summary>
/// Gets the accessibility that should be applied at the property level for a property being
/// generated from the provided EdmMember.
///
/// defaults to public if no annotation is found.
/// </summary>
public static string ForProperty(EdmMember member)
{
if (member == null)
{
return null;
}
string getterAccess, setterAccess, propertyAccess;
CalculatePropertyAccessibility(member, out propertyAccess, out getterAccess, out setterAccess);
return propertyAccess;
}
示例8: FieldMetadata
/// <summary>
/// Used to construct a field metadata object relating a column ordinal and an ImemberMetadata.
/// </summary>
/// <param name="ordinal">Column oridnal</param>
/// <param name="fieldType">Metadata member</param>
public FieldMetadata(int ordinal, EdmMember fieldType) {
if (ordinal < 0) {
throw EntityUtil.ArgumentOutOfRange("ordinal");
}
if (null == fieldType) {
throw EntityUtil.ArgumentNull("fieldType");
}
_fieldType = fieldType;
_ordinal = ordinal;
}
示例9: FieldMetadata
/// <summary>
/// Used to construct a field metadata object relating a column ordinal and an ImemberMetadata.
/// </summary>
/// <param name="ordinal">Column oridnal</param>
/// <param name="fieldType">Metadata member</param>
public FieldMetadata(int ordinal, EdmMember fieldType)
{
if (ordinal < 0)
{
throw new ArgumentOutOfRangeException("ordinal");
}
if (null == fieldType)
{
throw new ArgumentNullException("fieldType");
}
_fieldType = fieldType;
_ordinal = ordinal;
}
示例10: AccessibilityFromGettersAndSetters
protected static MemberAttributes AccessibilityFromGettersAndSetters(EdmMember property)
{
MemberAttributes scope = MemberAttributes.Private;
MemberAttributes getter = GetGetterAccessibility(property);
if (IsLeftMoreAccessableThanRight(getter, scope))
{
scope = getter;
}
MemberAttributes setter = GetSetterAccessibility(property);
if (IsLeftMoreAccessableThanRight(setter, scope))
{
scope = setter;
}
return scope;
}
示例11: TryGetMember
/// <summary>
/// Given the type in the target space and the member name in the source space,
/// get the corresponding member in the target space
/// For e.g. consider a Conceptual Type Foo with a member bar and a CLR type
/// XFoo with a member YBar. If one has a reference to Foo one can
/// invoke GetMember(Foo,"YBar") to retrieve the member metadata for bar
/// </summary>
/// <param name="type">The type in the target perspective</param>
/// <param name="memberName">the name of the member in the source perspective</param>
/// <param name="ignoreCase">true for case-insensitive lookup</param>
/// <param name="outMember">returns the edmMember if a match is found</param>
/// <returns>true if a match is found, otherwise false</returns>
internal override bool TryGetMember(StructuralType type, String memberName, bool ignoreCase, out EdmMember outMember)
{
outMember = null;
Map map = null;
if (this.MetadataWorkspace.TryGetMap(type, DataSpace.OCSpace, out map))
{
ObjectTypeMapping objectTypeMap = map as ObjectTypeMapping;
if (objectTypeMap!=null)
{
ObjectMemberMapping objPropertyMapping = objectTypeMap.GetMemberMapForClrMember(memberName, ignoreCase);
if (null != objPropertyMapping)
{
outMember = objPropertyMapping.EdmMember;
return true;
}
}
}
return false;
}
示例12: Add
/// <summary>
/// Add an entry that the given property of the given var is a computation represented
/// by the computationTemplate over the var represented by the given groupAggregateVarInfo
/// </summary>
/// <param name="var"></param>
/// <param name="groupAggregateVarInfo"></param>
/// <param name="computationTemplate"></param>
/// <param name="isUnnested"></param>
/// <param name="property"></param>
internal void Add(
Var var, GroupAggregateVarInfo groupAggregateVarInfo, Node computationTemplate, bool isUnnested, EdmMember property)
{
if (property == null)
{
Add(var, groupAggregateVarInfo, computationTemplate, isUnnested);
return;
}
if (_groupAggregateVarRelatedVarPropertyToInfo == null)
{
_groupAggregateVarRelatedVarPropertyToInfo = new Dictionary<Var, Dictionary<EdmMember, GroupAggregateVarRefInfo>>();
}
Dictionary<EdmMember, GroupAggregateVarRefInfo> varPropertyDictionary;
if (!_groupAggregateVarRelatedVarPropertyToInfo.TryGetValue(var, out varPropertyDictionary))
{
varPropertyDictionary = new Dictionary<EdmMember, GroupAggregateVarRefInfo>();
_groupAggregateVarRelatedVarPropertyToInfo.Add(var, varPropertyDictionary);
}
varPropertyDictionary.Add(property, new GroupAggregateVarRefInfo(groupAggregateVarInfo, computationTemplate, isUnnested));
// Note: The following line is not necessary with the current usage pattern, this method is
// never called with a new groupAggregateVarInfo thus it is a no-op.
_groupAggregateVarInfos.Add(groupAggregateVarInfo);
}
示例13: CreateMemberPlaceholder
/// <summary>
/// Returns a placeholder for a specific metadata member.
/// </summary>
/// <param name="member">EdmMember for which to produce a placeholder.</param>
/// <returns>Placeholder element for the given member.</returns>
private PropagatorResult CreateMemberPlaceholder(EdmMember member)
{
EntityUtil.CheckArgumentNull(member, "member");
return Visit(member);
}
示例14: ValidateMemberForAdd
/// <summary>
/// Validates a EdmMember object to determine if it can be added to this type's
/// Members collection. If this method returns without throwing, it is assumed
/// the member is valid.
/// </summary>
/// <param name="member">The member to validate</param>
/// <exception cref="System.ArgumentException">Thrown if the member is not a EdmProperty</exception>
internal override void ValidateMemberForAdd(EdmMember member)
{
Debug.Assert(
Helper.IsEdmProperty(member) || Helper.IsNavigationProperty(member),
"Only members of type Property may be added to ComplexType.");
}
示例15: GenerateMemberTSql
// Generates T-SQL describing a member
// Requires: member must belong to an entity type (a safe requirement for DML
// SQL gen, where we only access table columns)
private static string GenerateMemberTSql(EdmMember member)
{
return SqlGenerator.QuoteIdentifier(member.Name);
}