public static void ValidateMetadata(IProjection projection) { if (!projection.Identity.Schema.Equals(projection.Metadata.Identity.Schema)) { throw ProjectionException.FromProjection(projection, "Metadata and identity must belong to the same schema."); } }
public static void ValidateAttributes(IProjection projection) { if (projection.Attributes.Any(a => !a.Metadata.Identity.Schema.Equals(projection.Metadata.Identity.Schema))) { throw ProjectionException.FromProjection(projection, "All attributes must belong to the same projection schema."); } }
public static void ValidateField(IProjection projection) { if (projection.Source != null && !projection.Identity.Schema.Equals(projection.Source.Identity.Schema)) { throw ProjectionException.FromProjection(projection, "Field and identity must belong to the same schema."); } }
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; }
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 Projection(IProjectionIdentity identity, IProcContext context, IProjectionMetadata metadata) { this.Identity = identity ?? throw ProjectionException.ArgumentNull(nameof(identity)); this.Context = context ?? throw ProjectionException.ArgumentNull(nameof(context)); this.Metadata = metadata ?? throw ProjectionException.FromAttribute(identity.Schema.Model, null, message: "Projection metadata not found."); this.Source = identity.Field; this.Options = new ProjectionOptions(); this.Attributes = this.CreateDefaultAttributes(this.Metadata); }
protected ProjectionAttribute(IProjectionAttribute attribute, IProjectionMetadata metadata, IProjectionData data, ISqlContent content) { if (attribute == null) { throw ProjectionException.ArgumentNull(nameof(attribute), metadata); } this.Context = attribute.Context; this.Identity = attribute.Identity; this.Metadata = metadata ?? throw ProjectionException.ArgumentNull(nameof(metadata), metadata); this.Data = data; this.Content = content ?? throw ProjectionException.ArgumentNull(nameof(content), metadata); }
public static IProjectionMetadata GetPreferredTableMetadata(IProjectionMetadata metadata) { if (metadata.Table != null) { return(metadata); } else if (metadata.Item?.Table != null) { return(metadata.Item); } throw ProjectionException.TableNotFound(metadata); }
protected ProjectionAttribute(IProjectionAttribute attribute, IProjectionMetadata metadata, ISqlContent content, Func <IField> field) { if (attribute == null) { throw ProjectionException.ArgumentNull(nameof(attribute), this); } this.Context = attribute.Context; this.Identity = attribute.Identity; this.Metadata = metadata ?? throw ProjectionException.ArgumentNull(nameof(attribute), this); this.Content = content ?? throw ProjectionException.ArgumentNull(nameof(content), this); this.Field = field; }
protected Projection(IProjection projection, IProjectionMetadata metadata, IProjectionData data, IEnumerable <IProjectionAttribute> header, IProjectionOptions options) { if (projection == null) { throw ProjectionException.ArgumentNull(nameof(projection), metadata: null); } this.Identity = projection.Identity; this.Context = projection.Context; this.Metadata = metadata ?? throw ProjectionException.ArgumentNull(nameof(metadata), metadata); this.Data = data; this.Header = header ?? throw ProjectionException.ArgumentNull(nameof(header), metadata); this.Options = options ?? throw ProjectionException.ArgumentNull(nameof(options), metadata); }
protected Projection(IProjection projection) { if (projection == null) { throw ProjectionException.ArgumentNull(nameof(projection), metadata: null); } this.Identity = projection.Identity; this.Context = projection.Context; this.Metadata = projection.Metadata; this.Data = projection.Data; this.Header = projection.Header; this.Options = projection.Options; }
protected Projection(IProjection projection, IProjectionMetadata metadata, IEnumerable <IProjectionAttribute> attributes, IField field, IProjectionOptions options) { if (projection == null) { throw ProjectionException.ArgumentNull(nameof(projection)); } this.Identity = projection.Identity; this.Context = projection.Context; this.Metadata = metadata ?? throw ProjectionException.ArgumentNull(nameof(projection)); this.Attributes = attributes ?? throw ProjectionException.ArgumentNull(nameof(attributes)); this.Options = options ?? throw ProjectionException.ArgumentNull(nameof(options)); this.Source = field; }
protected Projection(IProjection projection) { if (projection == null) { throw ProjectionException.ArgumentNull(nameof(projection)); } this.Identity = projection.Identity; this.Context = projection.Context; this.Metadata = projection.Metadata; this.Attributes = projection.Attributes; this.Options = projection.Options; this.Source = projection.Source; }
public static IProjectionMetadata GetMetadataFromRelativeLambda(IProjection projection, LambdaExpression expression) { if (expression == null) { throw new ArgumentNullException(nameof(expression)); } string name = projection.Metadata.Identity.Notation.Lambda(expression) ?? throw ProjectionException.InvalidLambda(projection.Metadata, expression); string fullName = projection.Metadata.Identity.Notation.Combine(projection.Metadata.Identity.Name, name); return(projection.Metadata.Identity.Schema.Require <IProjectionMetadata>(fullName)); }
public static IJsonMetadata GetJsonMetadata(IProjectionMetadata metadata) => metadata.Identity.Lookup <IJsonMetadata>() ?? throw ProjectionException.JsonNotFound(metadata);
public static ITableMetadata GetColumnMetadata(IProjectionAttribute attribute) => attribute.Metadata.Column ?? attribute.Metadata.Item?.Column ?? throw ProjectionException.ColumnNotFound(attribute.Metadata);