Exemplo n.º 1
0
        /// <summary>
        /// Gets the custom field descriptors.
        /// </summary>
        /// <param name="ephorteContext">The ephorte context.</param>
        /// <param name="dataObjectName">Name of the data object.</param>
        /// <param name="predicate">The predicate.</param>
        /// <param name="category">The category.</param>
        /// <returns></returns>
        public static ICollection <ICustomFieldDescriptor> GetCustomFieldDescriptors(this IEphorteContext ephorteContext, string dataObjectName, string predicate, string category)
        {
            var dataObject          = ephorteContext.Create(dataObjectName);
            var dataObjectType      = dataObject.GetType();
            var predicateExpression = DynamicExpression.ParseLambda(dataObjectType, typeof(bool), predicate);
            var primaryKeys         = ExtractPrimaryKeyFromKeySelector(predicateExpression);

            return(ephorteContext.GetCustomFieldDescriptors(dataObjectName, primaryKeys, category));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Finds the specified ephorte context.
        /// </summary>
        /// <param name="ephorteContext">The ephorte context.</param>
        /// <param name="dataObjectName">Name of the data object.</param>
        /// <param name="predicate">The predicate.</param>
        /// <param name="relatedObjects">The related objects.</param>
        /// <returns></returns>
        public static IDataObjectAccess Find(this IEphorteContext ephorteContext, string dataObjectName, string predicate, params string[] relatedObjects)
        {
            var dataObject          = ephorteContext.Create(dataObjectName);
            var dataObjectType      = dataObject.GetType();
            var predicateExpression = DynamicExpression.ParseLambda(dataObjectType, typeof(bool), predicate);
            var primaryKeys         = ExtractPrimaryKeyFromKeySelector(predicateExpression);

            return(ephorteContext.Find(dataObjectName, primaryKeys, relatedObjects));
        }