小编Iro*_*sun的帖子

ASP.NET CORE中的Request.Files

我正在尝试使用ajax请求使用aspnet核心上传文件.在以前的.net版本中我曾经使用过

 foreach (string fileName in Request.Files)
            {
                HttpPostedFileBase file = Request.Files[fileName];
                //Save file content goes here

                fName = file.FileName;
     (...)
Run Code Online (Sandbox Code Playgroud)

但现在它在request.files显示错误我怎么能让它工作?我搜索并发现httppostedfile已更改为iformfile但如何处理request.files?

asp.net ajax upload file asp.net-core

18
推荐指数
3
解决办法
1万
查看次数

behaviourSubject in angular2,它是如何工作的以及如何使用它

我正在尝试构建一个共享服务,如下所示

import {Injectable,EventEmitter}     from 'angular2/core';
import {Subject} from 'rxjs/Subject';
import {BehaviorSubject} from 'rxjs/subject/BehaviorSubject';
@Injectable()
export class SearchService {

    public country = new Subject<SharedService>();
    public space: Subject<SharedService> = new BehaviorSubject<SharedService>(null);
    searchTextStream$ = this.country.asObservable();

    broadcastTextChange(text: SharedService) {
        this.space.next(text);
        this.country.next(text);
    }
}
export class SharedService {
    country: string;
    state: string;
    city: string;  
    street: string;
}
Run Code Online (Sandbox Code Playgroud)

我不知道如何实现BehaviourSubject基本上我在这里尝试的只是一团糟我猜我在使用子组件调用这个值

console.log('behiob' + shared.space.single());
Run Code Online (Sandbox Code Playgroud)

这是一个错误,因为.single()/ last()等等什么是可用的不是一个函数所以有人可以告诉我它是如何工作的以及如何实现它,因为我搜索的例子但没有一个对我有意义.

rxjs angular2-changedetection angular

13
推荐指数
1
解决办法
2万
查看次数

在二维码中央放置徽标是否安全?

我需要创建一个中心有徽标的二维码,所以首先我认为它可能需要一些不同的库。

为了进行实验,我只是使用 Illustrator 将徽标放在提供的二维码的中心,扫描仪就能够读取它。我在徽标下面使用了黑色和白色背景,但它仍然可以正确读取。

所以我的问题是:如果我在任何二维码的中心放置一个徽标,它会正常工作还是我应该使用一个库来解决这个问题?

qr-code

8
推荐指数
1
解决办法
3885
查看次数

使用共享服务在 Angular2 中进行更改检测

我有一个父函数ngOnInit(),它从谷歌地图获取值,如下所示

instance.input = document.getElementById('google_places_ac');
        autocomplete = new google.maps.places.Autocomplete(instance.input, { types: ['(cities)']});
        google.maps.event.addListener(autocomplete, 'place_changed', function () {
            var place = autocomplete.getPlace();
            instance.setValue(place.address_components[3].long_name, place.address_components[2].long_name, place.address_components[1].long_name);

        });
Run Code Online (Sandbox Code Playgroud)

setValue()是与共享服务共享价值的函数,在 html 页面上我有与父级和子级相同的内容 <input id="google_places_ac" [(attr.state)]="state" [(attr.country)]="coutnry" name="google_places_ac" type="text" value="{{city}}" class="form-control" />

在父组件类中,我对setValue()函数触发更改检测

   setValue(a, b, c) {
        this.coutnry = a;
        this.state = b;
        this.city = c;
        this.sharedService.country = this.coutnry;
        this.sharedService.city = this.city;
        this.sharedService.state = this.state;
        this.cdr.detectChanges();
      //  console.log(this.coutnry, this.state, this.city);
    }
Run Code Online (Sandbox Code Playgroud)

这在父级上运行良好,但在子级上没有发生更改,我创建了一个单击函数,该函数在子级上触发更改检测,这也有效,但我希望它从父级自动触发,有什么解决方法吗?

angular2-changedetection angular

1
推荐指数
1
解决办法
1981
查看次数

一个简单的选择查询,在3000万行上花费8分钟

我的表有3000万行,并且它每天都在增加,但现在只需简单的选择查询

Select top 10 * from table order by entrydate desc
Run Code Online (Sandbox Code Playgroud)

是否需要超过8分钟,任何解决方案?

sql sql-server

0
推荐指数
1
解决办法
63
查看次数