예제 #1
0
 public static BaseJsonHandler Init(JsonRepository repository, ref JsonResponseState state)
 {
     return(new JsonPrepareRequestHandler()
            .SetRepository(repository)
            .SetState(ref state)
            .Handle());
 }
예제 #2
0
        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);
        }
예제 #3
0
 private BaseJsonHandler SetState(ref JsonResponseState state)
 {
     _state = state;
     return(this);
 }