コード例 #1
0
        private IEnumerable <IProjectionAttribute> CreateDefaultHeader(IProjectionMetadata metadata)
        {
            ProjectionIdentity identity = this.Identity;
            IProcContext       context  = this.Context;
            IEnumerable <IProjectionMetadata> header = this.SelectAttributes(metadata);

            if (this.Data != null)
            {
                using ProjectionReader reader = new ProjectionReader(this.Data.Source, header);

                if (reader.Read())
                {
                    foreach (var(valueMetadata, data) in header.Zip(reader.GetData()))
                    {
                        yield return(new ProjectionAttribute(identity, context, valueMetadata, data));
                    }

                    yield break;
                }
            }

            foreach (IProjectionMetadata attributeMetadata in header)
            {
                yield return(new ProjectionAttribute(identity, context, attributeMetadata, data: null));
            }
        }
コード例 #2
0
 public ProjectionAttribute(ProjectionIdentity identity, IProcContext context, IProjectionMetadata metadata, IProjectionData data)
 {
     this.Identity = identity ?? throw ProjectionException.ArgumentNull(nameof(identity), metadata);
     this.Context  = context ?? throw ProjectionException.ArgumentNull(nameof(context), metadata);
     this.Metadata = metadata ?? throw ProjectionException.ArgumentNull(nameof(metadata), metadata);
     this.Data     = data;
     this.Content  = SqlContent.Empty;
 }
コード例 #3
0
 public Projection(ProjectionIdentity identity, IProcContext context, IProjectionMetadata metadata)
 {
     this.Identity = identity ?? throw ProjectionException.ArgumentNull(nameof(identity), metadata);
     this.Context  = context ?? throw ProjectionException.ArgumentNull(nameof(context), metadata);
     this.Metadata = metadata;
     this.Data     = ProjectionData.Resolve(identity);
     this.Options  = ProjectionOptions.Default;
     this.Header   = this.CreateDefaultHeader(metadata);
 }
コード例 #4
0
        internal static IProjectionData Resolve(ProjectionIdentity identity)
        {
            if (identity.Source != null)
            {
                return(new ProjectionData(identity.Source));
            }

            return(null);
        }
コード例 #5
0
        public ProjectionValues(IProcContext context, ProjectionIdentity identity, IEnumerable <IProjection <TItem> > items, int batchIndex = -1)
        {
            this.Context    = context ?? throw new ArgumentNullException(nameof(context));
            this.Identity   = identity ?? throw new ArgumentNullException(nameof(identity));
            this.Items      = items ?? throw new ArgumentNullException(nameof(identity));
            this.BatchIndex = batchIndex;

            if (this.Items is IProjectionValues <TItem> innerValues)
            {
                this.Items = innerValues.Items;
            }
        }
コード例 #6
0
 public Projection(ProjectionIdentity identity, IProcContext context, IProjectionMetadata metadata)
     : base(identity, context, metadata)
 {
 }