예제 #1
0
        private string GetRelatedEntityPropertyName(QueryAttribute qa)
        {
            switch (qa.QueryType)
            {
            case QueryType.FkQuery:
                return(((FkQueryAttribute)qa).RelatedManyToOneQueryPropertyName);

            default:
                return(null);
            }
        }
예제 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="QueryDescriber"/> class.
        /// </summary>
        /// <param name="qa">The query attribute instance.</param>
        /// <param name="pi">The property's property info.</param>
        /// <param name="propertyEntityType">The entity type that the property returns.</param>
        /// <param name="entityType">The entity type.</param>
        public QueryDescriber(QueryAttribute qa, PropertyInfo pi, Type propertyEntityType, Type entityType)
        {
            this.qa = qa;

            //parse info from pi
            propertyName = pi.Name;
            relatedEntityPropertyName = GetRelatedEntityPropertyName(qa);
            //entityName = pi.ReflectedType.Name;
            //entityType = pi.ReflectedType;
            entityPk                    = GetPkPropertyName(entityType);
            relatedEntityType           = propertyEntityType;
            relatedEntityPk             = GetPkPropertyName(propertyEntityType);
            relatedEntityPkPropertyInfo = GetPkPropertyInfo(propertyEntityType);
            //relationKeysMap = GetRelationKeysMap(qa);
            relatedEntityPkType = GetPkPropertyType(propertyEntityType);
        }
예제 #3
0
        private Dictionary <string, string> GetRelationKeysMap(QueryAttribute qa)
        {
            switch (qa.QueryType)
            {
            case QueryType.ManyToManyQuery:
                return(GetRelationKeysMapFromRelationType(((ManyToManyQueryAttribute)qa).RelationType));

            case QueryType.CustomQuery:
                if (((CustomQueryAttribute)qa).RelationType != null)
                {
                    return(GetRelationKeysMapFromRelationType(((CustomQueryAttribute)qa).RelationType));
                }
                else
                {
                    return(null);
                }

            default:
                return(null);
            }
        }