使用新的Service实现,我是否必须为我的所有服务提供Options方法?
使用我的所有服务当前使用的旧ServiceBase方法,OPTIONS在没有Access-Control-Allow-Origin标头的情况下返回OK.
这是一个例子:
https://github.com/JonCanning/SSCors
HelloService使用Service
GoodbyeService使用ServiceBase
刚刚升级到 v2,这不再有效;如果我尝试使用 Count(),我会收到类似的错误
public class Deck_Ratings : AbstractIndexCreationTask<DeckRating, Deck_Ratings.ReduceResult>
{
public class ReduceResult
{
public string DeckId { get; set; }
public int Rating { get; set; }
}
public Deck_Ratings()
{
Map = deckRatings => deckRatings.Select(deckRating => new
{
deckRating.DeckId,
deckRating.Rating
});
Reduce = reduceResults => reduceResults
.GroupBy(reduceResult => reduceResult.DeckId)
.Select(grouping => new
{
DeckId = grouping.Key,
Rating = grouping.Average(reduceResult => reduceResult.Rating)
});
}
}
Run Code Online (Sandbox Code Playgroud)