예제 #1
0
        public override TBusinesEntity Reload(TBusinesEntity entity, IInclude <TBusinesEntity> include)
        {
            var reloadEntity = Reload(entity);

            include.Include(reloadEntity);
            return(reloadEntity);
        }
예제 #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);
        }
예제 #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());
        }
예제 #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);
        }
예제 #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));
        }
예제 #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;
            }));
        }
예제 #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);
        }
예제 #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));
        }
예제 #10
0
 public IInclude <TEntity> With(IInclude <TEntity> include)
 {
     _include.With(include);
     return(this);
 }
예제 #11
0
 public TreeNode(string name, IInclude model) : this(name)
 {
     NodeModel = model;
 }
예제 #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);
     }
 }
예제 #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);
        }
예제 #14
0
 public AppointmentRepository(ClinicContext context, IInclude include) : base(context)
 {
     _include = include;
 }
예제 #15
0
 public abstract IEnumerable <TBusinesEntity> LazyQuery(ISpecification <TBusinesEntity> specification, IInclude <TBusinesEntity> include);
예제 #16
0
 public FolderNode(string name, IInclude model) : base(name, model)
 {
 }
예제 #17
0
파일: FileNode.cs 프로젝트: WPNetC/ProjApp
 public FileNode(string name, IInclude model) : base(name, model)
 {
 }
예제 #18
0
 public IInclude <TBusinesEntity> With(IInclude <TBusinesEntity> include)
 {
     _Includes.Add(include);
     return(this);
 }
예제 #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;
        }
예제 #20
0
 public abstract TBusinesEntity Reload(TBusinesEntity entity, IInclude <TBusinesEntity> include);