Exemplo n.º 1
0
        public override bool TryGetDelegationMetadata(CallNode node, TexlBinding binding, out IDelegationMetadata metadata)
        {
            Contracts.AssertValue(node);
            Contracts.AssertValue(binding);

            metadata = null;

            // Get metadata if it's an entity.
            IExpandInfo entityInfo;

            if (binding.TryGetEntityInfo(node.Args.Children[0], out entityInfo))
            {
                Contracts.AssertValue(entityInfo.ParentDataSource);
                Contracts.AssertValue(entityInfo.ParentDataSource.DataEntityMetadataProvider);

                var metadataProvider = entityInfo.ParentDataSource.DataEntityMetadataProvider;

                IDataEntityMetadata entityMetadata;
                if (!metadataProvider.TryGetEntityMetadata(entityInfo.Identity, out entityMetadata))
                {
                    return(false);
                }

                metadata = entityMetadata.DelegationMetadata.VerifyValue();
                return(true);
            }

            if (!TryGetValidDataSourceForDelegation(node, binding, FunctionDelegationCapability, out var ds))
            {
                return(false);
            }

            metadata = ds.DelegationMetadata;
            return(true);
        }
Exemplo n.º 2
0
        private bool TryGetEntityInfo(DottedNameNode dottedNameNode, TexlBinding binding, out IExpandInfo entityInfo)
        {
            Contracts.AssertValueOrNull(dottedNameNode);
            Contracts.AssertValue(binding);

            entityInfo = null;
            if (dottedNameNode == null || !binding.HasExpandInfo(dottedNameNode))
            {
                return(false);
            }

            return(binding.TryGetEntityInfo(dottedNameNode, out entityInfo));
        }
Exemplo n.º 3
0
        private bool TryGetEntityInfo(FirstNameNode firstName, TexlBinding binding, out IExpandInfo entityInfo)
        {
            Contracts.AssertValueOrNull(firstName);
            Contracts.AssertValue(binding);

            entityInfo = null;
            if (firstName == null || !binding.GetType(firstName).IsTable)
            {
                return(false);
            }

            return(binding.TryGetEntityInfo(firstName, out entityInfo));
        }
        private bool TryGetDsInfo(DottedNameNode dottedNameNode, TexlBinding binding, out IExternalDataSource dsInfo)
        {
            Contracts.AssertValueOrNull(dottedNameNode);
            Contracts.AssertValue(binding);

            dsInfo = null;
            if (dottedNameNode == null || !binding.HasExpandInfo(dottedNameNode))
            {
                return(false);
            }

            IExpandInfo info;

            binding.TryGetEntityInfo(dottedNameNode, out info).Verify();
            dsInfo = info.ParentDataSource;
            return(true);
        }