コード例 #1
0
 private static void AddReferenceNavigationColumns(List <EntityDataSourceColumn> columns, MetadataWorkspace ocWorkspace, EntitySet entitySet, EntityType entityType)
 {
     foreach (AssociationSetEnd toEnd in GetReferenceEnds(entitySet, entityType, /*forKey*/ false))
     {
         // Check for a navigation property
         NavigationProperty navigationProperty;
         if (TryGetCorrespondingNavigationProperty(toEnd.CorrespondingAssociationEndMember, out navigationProperty))
         {
             Type clrToType = EntityDataSourceUtil.GetMemberClrType(ocWorkspace, navigationProperty);
             EntityDataSourceReferenceValueColumn column = EntityDataSourceReferenceValueColumn.Create(clrToType, ocWorkspace, navigationProperty);
             columns.Add(column);
         }
     }
 }
コード例 #2
0
        internal EntityDataSourceMemberPath(MetadataWorkspace ocWorkspace, EntityDataSourceMemberPath parent, EdmProperty property, bool isLocallyInteresting)
        {
            EntityDataSourceUtil.CheckArgumentNull(ocWorkspace, "ocWorkspace");
            EntityDataSourceUtil.CheckArgumentNull(property, "property");

            this.property             = property;
            this.parent               = parent;
            this.isLocallyInteresting = isLocallyInteresting;
            this.clrType              = EntityDataSourceUtil.GetMemberClrType(ocWorkspace, property);
            this.isKey = IsPropertyAKey(property);

            // retrieve PropertyInfo (with respect to parent CLR type)
            StructuralType parentType    = property.DeclaringType;
            Type           parentClrType = EntityDataSourceUtil.GetClrType(ocWorkspace, parentType);

            this.propertyInfo = EntityDataSourceUtil.GetPropertyInfo(parentClrType, this.property.Name);
        }
コード例 #3
0
        internal EntityDataSourceReferenceKeyColumn(MetadataWorkspace workspace, EntityDataSourceReferenceGroup group, EdmProperty keyMember, EntityDataSourceColumn dependent)
            : base(CreateDisplayName(group, keyMember), dependent)
        {
            EntityDataSourceUtil.CheckArgumentNull(group, "group");
            EntityDataSourceUtil.CheckArgumentNull(keyMember, "keyMember");
            Debug.Assert(EntityDataSourceUtil.IsScalar(keyMember.TypeUsage.EdmType), "Expected primitive or enum type for key members.");

            this.group     = group;
            this.keyMember = keyMember;
            this.clrType   = EntityDataSourceUtil.GetMemberClrType(workspace, keyMember);

            // if the association end is optional (0..1), make sure the CLR type
            // is also nullable
            if (this.group.End.CorrespondingAssociationEndMember.RelationshipMultiplicity == RelationshipMultiplicity.ZeroOrOne)
            {
                this.clrType    = EntityDataSourceUtil.MakeNullable(clrType);
                this.isNullable = true;
            }
        }