Beispiel #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));
            }
        }
 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;
 }
Beispiel #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);
 }
        internal static IProjectionData Resolve(ProjectionIdentity identity)
        {
            if (identity.Source != null)
            {
                return(new ProjectionData(identity.Source));
            }

            return(null);
        }
        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;
            }
        }
Beispiel #6
0
 public Projection(ProjectionIdentity identity, IProcContext context, IProjectionMetadata metadata)
     : base(identity, context, metadata)
 {
 }