Exemple #1
0
        public static IDataObjectAccess <TDataObject> Find <TDataObject>(this IEphorteContext ephorteContext, Expression <Func <TDataObject, bool> > predicate, params Expression <Func <TDataObject, object> >[] includeSelectors) where TDataObject : class
        {
            var relatedObjects = includeSelectors.Select(EvaluateMemberSelector).ToArray();
            var result         = ephorteContext.Find(typeof(TDataObject).Name, ExtractPrimaryKeyFromKeySelector(predicate), relatedObjects);

            return(new TypedDataObjectAccess <TDataObject>(result));
        }
Exemple #2
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));
        }
Exemple #3
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));
        }
 protected override void OnEphorteContextChanged(IEphorteContext ephorteContext)
 {
     _ephorte = new EphorteContextHelper(ephorteContext);
 }
Exemple #5
0
 protected virtual void OnEphorteContextChanged(IEphorteContext ephorteContext)
 {
 }
Exemple #6
0
 public static ICollection <ICustomFieldDescriptor> GetCustomFieldDescriptors <TDataObject>(this IEphorteContext ephorteContext, Expression <Func <TDataObject, bool> > predicate, string category)
 {
     return(ephorteContext.GetCustomFieldDescriptors(typeof(TDataObject).Name, ExtractPrimaryKeyFromKeySelector(predicate), category));
 }
Exemple #7
0
        /// <summary>
        /// Initializes the specified ephorte context.
        /// </summary>
        /// <typeparam name="TDataObject">The type of the data object.</typeparam>
        /// <param name="ephorteContext">The ephorte context.</param>
        /// <param name="dataObject">The data object.</param>
        /// <returns></returns>
        public static IDataObjectAccess <TDataObject> Initialize <TDataObject>(this IEphorteContext ephorteContext, TDataObject dataObject) where TDataObject : class
        {
            var result = ephorteContext.Initialize(dataObject);

            return(new TypedDataObjectAccess <TDataObject>(result));
        }
Exemple #8
0
        /// <summary>
        /// Initializes the specified ephorte context.
        /// </summary>
        /// <typeparam name="TDataObject">The type of the data object.</typeparam>
        /// <param name="ephorteContext">The ephorte context.</param>
        /// <param name="dataObject">The data object.</param>
        /// <returns></returns>
        public static async Task <IDataObjectAccess <TDataObject> > InitializeAsync <TDataObject>(this IEphorteContext ephorteContext, TDataObject dataObject) where TDataObject : class
        {
            var result = await ephorteContext.InitializeAsync(dataObject);

            return(new TypedDataObjectAccess <TDataObject>(result));
        }
Exemple #9
0
 /// <summary>
 /// Creates the specified ephorte context.
 /// </summary>
 /// <typeparam name="TDataObject">The type of the T data object.</typeparam>
 /// <param name="ephorteContext">The ephorte context.</param>
 /// <returns>``0.</returns>
 public static TDataObject Create <TDataObject>(this IEphorteContext ephorteContext)
 {
     return((TDataObject)ephorteContext.Create(typeof(TDataObject).Name));
 }
 protected override void OnEphorteContextChanged(IEphorteContext ephorteContext)
 {
     _ephorte = new EphorteContextHelper(ephorteContext);
 }
 protected virtual void OnEphorteContextChanged(IEphorteContext ephorteContext) { }
Exemple #12
0
 public EphorteContextHelper(IEphorteContext ephorteContext)
 {
     _ephorteContext = ephorteContext;
 }
 public EphorteContextHelper(IEphorteContext ephorteContext)
 {
     _ephorteContext = ephorteContext;
 }
Exemple #14
0
 public Oms(Action <string> logInformation, NCoreFactory nCoreFactory)
 {
     _log = logInformation
            ?? throw new ArgumentNullException(nameof(logInformation));
     EphorteContext = nCoreFactory.Create();
 }