コード例 #1
0
 public static TEntity Find <TEntity, TOptions>(
     this ICrudService <TEntity, TOptions> service, TEntity entity, object context = null)
     where TEntity : IEntity where TOptions : ICrudServiceOptions
 => service.Find(service.CreateEqualityComparerExpression(entity),
                 context == null
             ? DefaultCrudServiceOptions.Default <TOptions>()
                 : DefaultCrudServiceOptions.FromContext <TOptions>(context));
コード例 #2
0
 public static TSelect Find <TEntity, TOptions, TSelect>(
     this ICrudService <TEntity, TOptions> service, Expression <Func <TEntity, bool> > predicate,
     Expression <Func <TEntity, TSelect> > select, object context = null)
     where TEntity : IEntity where TOptions : ICrudServiceOptions => service.Find(predicate, select,
                                                                                  context == null
             ? DefaultCrudServiceOptions.Default <TOptions>()
                                                                                  : DefaultCrudServiceOptions.FromContext <TOptions>(context));
コード例 #3
0
 public static Task <TSelect> FindAsync <TEntity, TOptions, TSelect>(
     this ICrudService <TEntity, TOptions> service, TEntity entity, Expression <Func <TEntity, TSelect> > select,
     object context = null)
     where TEntity : IEntity where TOptions : ICrudServiceOptions
 => Task.Run(() => service.Find(service.CreateEqualityComparerExpression(entity), select,
                                context == null
             ? DefaultCrudServiceOptions.Default <TOptions>()
                                : DefaultCrudServiceOptions.FromContext <TOptions>(context)));
コード例 #4
0
        public IActionResult PostAsync([FromBody] WorkdsInRelationship body)
        {
            var result = crudService.Find();

            if (result == null)
            {
                return(BadRequest());
            }
            return(Ok(result));
        }
コード例 #5
0
 public static Task <TEntity> FindAsync <TEntity, TOptions>(
     this ICrudService <TEntity, TOptions> service, Expression <Func <TEntity, bool> > predicate,
     object context = null)
     where TEntity : IEntity where TOptions : ICrudServiceOptions => Task.Run(() => service.Find(predicate,
                                                                                                 context == null
             ? DefaultCrudServiceOptions.Default <TOptions>()
                                                                                                 : DefaultCrudServiceOptions.FromContext <TOptions>(context)));