Ejemplo n.º 1
0
        public override TBusinesEntity Reload(TBusinesEntity entity, IInclude <TBusinesEntity> include)
        {
            var reloadEntity = Reload(entity);

            include.Include(reloadEntity);
            return(reloadEntity);
        }
Ejemplo n.º 2
0
        private object DoInclude(IInclude tag, IContainer parent, IValueStack stack)
        {
            var dal = ApplicationContext.Current.Dal;

            object component = CreateObject(stack, dal.GetScreenByName(tag.File));

            if (!(component is IComponent))
            {
                throw new Exception("Only Component container is allowed to be included");
            }

            object[] controls = ((IContainer)component).Controls;

            if (parent != null)
            {
                foreach (var control in controls)
                {
                    parent.AddChild(control);
                }
                return(parent);
            }

            // uglu hack: так как метод Build возвращает object, а нам нужно вернуть несколько объектов
            // , мы можем вернуть тут массив, но должны помнить,
            // что это массив (см. Controls/LayoutableContainerBehaviour.cs метод Inject)
            return(controls);
        }
Ejemplo n.º 3
0
        public Task <Customer> GetCustomerById(int id, IInclude <Customer> include = null)
        {
            var query = base.Set.Where(x => x.Id == id);

            if (include != null)
            {
                query = include.GetIncludes()(query);
            }
            return(query.FirstOrDefaultAsync());
        }
Ejemplo n.º 4
0
        internal void AddToIncludeSet(TDiscriminant discriminant, IInclude include)
        {
            if (_includeByDiscriminantValue.ContainsKey(discriminant))
            {
                throw new LinkItException(
                          $"Invalid configuration for linked source {typeof(TLinkedSource).GetFriendlyName()}, polymorphic list target {{{LinkTarget.Expression}}}: cannot have more than one include with the same discriminant ({discriminant})."
                          );
            }

            _includeByDiscriminantValue.Add(discriminant, include);
        }
Ejemplo n.º 5
0
        internal void AddToIncludeSet(TDiscriminant discriminant, IInclude include)
        {
            if (_includeByDiscriminantValue.ContainsKey(discriminant))
            {
                throw new ArgumentException(
                          $"{LinkTarget.Id}: cannot have many includes for the same discriminant ({discriminant})."
                          );
            }

            _includeByDiscriminantValue.Add(discriminant, include);
        }
        public string ResolvePath(string path)
        {
            IInclude include = FindInclude(path);

            if (include != null)
            {
                return(VersionPath(include.Src, include.Version ?? Version));
            }

            return(VersionPath(path, Version));
        }
Ejemplo n.º 7
0
        public IEnumerable <TBusinesEntity> Query(TQueryObject query, IInclude <TBusinesEntity> include)
        {
            var storeObjects = ExecuteQuery(DataContext, query);
            var mapper       = _mapperGenerator(DataContext);

            return(storeObjects.ToList().Select(s =>
            {
                var bEntity = mapper.MapStorageToBusines(s);
                include.Include(bEntity);
                return bEntity;
            }));
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Given an element parsed from a XAML file, this method unwraps the include's content and returns it,
        /// if it is an <see cref="IInclude"/>.
        /// </summary>
        /// <param name="maybeIncludeElement">Element parsed from a XAML file.</param>
        /// <returns>The given <paramref name="maybeIncludeElement"/> or its content, if it is an include.</returns>
        public static object UnwrapIncludesAndCleanup(object maybeIncludeElement)
        {
            IInclude include = maybeIncludeElement as IInclude;

            if (include == null)
            {
                return(maybeIncludeElement);
            }
            object      content    = include.PassContent();
            object      result     = UnwrapIncludesAndCleanup(content);
            IDisposable disposable = include as IDisposable;

            if (disposable != null)
            {
                disposable.Dispose();
            }
            return(result);
        }
Ejemplo n.º 9
0
        private LoadLinkProtocolForLinkedSourceBuilder <TLinkedSource> AddNonPolymorphicLoadLinkExpression <TTargetProperty, TId>(
            Func <TLinkedSource, IEnumerable <TId> > getLookupIds,
            ILinkTarget <TLinkedSource, TTargetProperty> linkTarget,
            IInclude include)
        {
            var loadLinkExpression = new LoadLinkExpressionImpl <TLinkedSource, TTargetProperty, TId, bool>(
                getLookupIds,
                linkTarget,
                new IncludeSet <TLinkedSource, TTargetProperty, TId, bool>(
                    new Dictionary <bool, IInclude>
            {
                {
                    true,         //always one include when not polymorphic
                    include
                }
            },
                    link => true
                    )
                );

            return(AddLoadLinkExpression(loadLinkExpression));
        }
Ejemplo n.º 10
0
 public IInclude <TEntity> With(IInclude <TEntity> include)
 {
     _include.With(include);
     return(this);
 }
Ejemplo n.º 11
0
 public TreeNode(string name, IInclude model) : this(name)
 {
     NodeModel = model;
 }
Ejemplo n.º 12
0
 public override IEnumerable <TBusinesEntity> LazyQuery(ISpecification <TBusinesEntity> specification, IInclude <TBusinesEntity> include)
 {
     foreach (var item in QueryBase(specification))
     {
         include.Include(item);
         yield return(item);
     }
 }
Ejemplo n.º 13
0
        public override IEnumerable <TBusinesEntity> Query(ISpecification <TBusinesEntity> specification, IInclude <TBusinesEntity> include)
        {
            var result = Query(specification);

            foreach (var item in result)
            {
                include.Include(item);
            }

            return(result);
        }
Ejemplo n.º 14
0
 public AppointmentRepository(ClinicContext context, IInclude include) : base(context)
 {
     _include = include;
 }
Ejemplo n.º 15
0
 public abstract IEnumerable <TBusinesEntity> LazyQuery(ISpecification <TBusinesEntity> specification, IInclude <TBusinesEntity> include);
Ejemplo n.º 16
0
 public FolderNode(string name, IInclude model) : base(name, model)
 {
 }
Ejemplo n.º 17
0
 public FileNode(string name, IInclude model) : base(name, model)
 {
 }
Ejemplo n.º 18
0
 public IInclude <TBusinesEntity> With(IInclude <TBusinesEntity> include)
 {
     _Includes.Add(include);
     return(this);
 }
Ejemplo n.º 19
0
        private object DoInclude(IInclude tag, IContainer parent, IValueStack stack)
        {
            var dal = ApplicationContext.Current.Dal;

            object component = CreateObject(stack, dal.GetScreenByName(tag.File));
            if (!(component is IComponent))
                throw new Exception("Only Component container is allowed to be included");

            object[] controls = ((IContainer)component).Controls;
                        
            if (parent != null)
            {
                foreach (var control in controls)
                    parent.AddChild(control);
                return parent;
            }

            // uglu hack: так как метод Build возвращает object, а нам нужно вернуть несколько объектов
            // , мы можем вернуть тут массив, но должны помнить,
            // что это массив (см. Controls/LayoutableContainerBehaviour.cs метод Inject)
            return controls;
        }
Ejemplo n.º 20
0
 public abstract TBusinesEntity Reload(TBusinesEntity entity, IInclude <TBusinesEntity> include);