예제 #1
0
        internal override string GetEntitySqlValue()
        {
            // it.NavigationPropertyName
            string result = EntityDataSourceUtil.EntitySqlElementAlias + "." + EntityDataSourceUtil.QuoteEntitySqlIdentifier(this.navigationProperty.Name);

            return(result);
        }
예제 #2
0
        internal override string GetEntitySqlValue()
        {
            // syntax: NAVIGATE(it, _association_type_name_, _target_role_name_)._key_member_
            StringBuilder builder = new StringBuilder();

            builder.Append("NAVIGATE(");
            builder.Append(EntityDataSourceUtil.EntitySqlElementAlias);
            builder.Append(", ");
            builder.Append(EntityDataSourceUtil.CreateEntitySqlTypeIdentifier(this.Group.End.ParentAssociationSet.ElementType));
            builder.Append(", ");
            builder.Append(EntityDataSourceUtil.QuoteEntitySqlIdentifier(this.Group.End.CorrespondingAssociationEndMember.Name));
            builder.Append(").");
            builder.Append(EntityDataSourceUtil.QuoteEntitySqlIdentifier(this.keyMember.Name));
            string result = builder.ToString();

            return(result);
        }
        internal string GetEntitySqlValue()
        {
            // it.[member1].[member2]...
            string prefix;

            if (null != parent)
            {
                prefix = parent.GetEntitySqlValue();
            }
            else
            {
                prefix = EntityDataSourceUtil.EntitySqlElementAlias;
            }

            string eSql = prefix + "." + EntityDataSourceUtil.QuoteEntitySqlIdentifier(this.property.Name);

            return(eSql);
        }
예제 #4
0
        private static string GenerateDefaultOrderByFromTypeUsage(TypeUsage tu)
        {
            StringBuilder orderByBuilder = new StringBuilder();
            ReadOnlyMetadataCollection <EdmProperty> propertyCollection;
            List <string> keyMemberNames = null;
            EntityType    entityType     = tu.EdmType as EntityType;

            if (null != entityType)
            {
                ReadOnlyMetadataCollection <EdmMember> keyMembers;
                keyMembers         = entityType.KeyMembers;
                keyMemberNames     = new List <string>(entityType.KeyMembers.Count);
                propertyCollection = entityType.Properties;

                foreach (EdmMember edmMember in keyMembers)
                {
                    keyMemberNames.Add(edmMember.Name);
                }
            }
            else
            {
                return(String.Empty);
            }

            foreach (EdmProperty property in propertyCollection)
            {
                if (keyMemberNames.Contains(property.Name) && EntityDataSourceUtil.IsScalar(property.TypeUsage.EdmType))
                {
                    if (0 < orderByBuilder.Length)
                    {
                        orderByBuilder.Append(", ");
                    }
                    orderByBuilder.Append(EntityDataSourceUtil.EntitySqlElementAlias);
                    orderByBuilder.Append(".");
                    orderByBuilder.Append(EntityDataSourceUtil.QuoteEntitySqlIdentifier(property.Name));
                }
            }
            return(orderByBuilder.ToString());
        }