public static BaseJsonHandler Init(JsonRepository repository, ref JsonResponseState state) { return(new JsonPrepareRequestHandler() .SetRepository(repository) .SetState(ref state) .Handle()); }
public JsonResponseState ValidatePrimaryKey(JObject data, string relationName, string schemaName = IDbSchema.DefaultSchema, List <string> primaryKeys = null) { var columns = primaryKeys == null ? _repository.Schema.GetColumns(relationName, schemaName).Where(q => q.IsPrimaryKey).ToImmutableArray() : _repository.Schema.GetColumns(relationName, schemaName).Where(q => primaryKeys.Contains(q.ColumnName)).ToImmutableArray(); var state = new JsonResponseState(data, columns, MandatoryColumns.All); BaseJsonHandler .Init(_repository, ref state) .Next <GenericJsonRequiredValidatorHandler>() .Next <GenericJsonTypeValidatorHandler>(); return(state); }
private BaseJsonHandler SetState(ref JsonResponseState state) { _state = state; return(this); }