我有这两个实体
public class Song : IPathHavingEntity
{
public int Id { get; set; }
[Required]
public string Path { get; set; }
[Required]
public virtual Album Album { get; set; }
[Required]
public int TrackNumber { get; set; }
}
public class Album : IPathHavingEntity
{
public int Id { get; set; }
[Required]
public string Path { get; set; }
public virtual IEnumerable<Song> Songs { get; set; }
[Required]
public int AlbumNumber { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
Path在 …
我使用 Firebase 的免费套餐,并且有一个由实时数据库写入触发的云功能。然后,该函数从 Firebase 存储 (~8 Mb) 下载文件,进行一些处理,然后写回实时数据库。我在整个函数中添加了一些日志语句,以找出为什么花了这么长时间。
当我在本地运行该函数时,它会在 10 秒内完成。为什么云函数内部需要如此长的时间?
函数/index.js
exports.doStuff = functions.database.ref('/my/path/{pushId}')
.onWrite(event => {
const implementation = require('./implementation');
// Variables omitted for brevity...
implementation.process(...variables);
return true;
});
Run Code Online (Sandbox Code Playgroud)
函数/implementation.js
function process(...variables) {
const Storage = require('@google-cloud/storage');
const storage = new Storage();
// Variables omitted for brevity...
const options = {
destination: tempFilePath,
};
storage
.bucket(bucketName)
.file(srcFilename)
.download(options)
.then(() => {
console.log('This takes 3+ minutes for an 8 Mb file'); …Run Code Online (Sandbox Code Playgroud) firebase firebase-realtime-database google-cloud-functions firebase-storage
我是ui-router的新手,无法获取layout.directory.teams或layout.directory.people加载各自的模板.我希望这些模板可以加载ui-view到layout状态模板上.
/dashboard工作正常... dashboard.html模板加载ui-view在content.html模板中.
/directory/teams不加载teams.html模板.
/directory/people不加载people.html模板.
.state('layout', {
abstract: true,
templateUrl: "components/common/content.html"
})
.state('layout.dashboard', {
url: "/dashboard",
controller: 'DashboardCtrl',
controllerAs: 'dashboard',
templateUrl: "app/features/dashboard/views/dashboard.html",
})
.state('layout.directory', {
abstract: true,
url: "/directory"
})
.state('layout.directory.teams', {
url: "/teams",
controller: 'DirectoryCtrl',
controllerAs: 'directory',
templateUrl: "app/features/directory/views/teams.html",
})
.state('layout.directory.people', {
url: "/people",
controller: 'DirectoryCtrl',
controllerAs: 'directory',
templateUrl: "app/features/directory/views/people.html",
})
Run Code Online (Sandbox Code Playgroud) 这是我的简单列表:
public class ProductStore
{
public List<Product> AllProducts
{
get
{
return new List<Product>
{
new Product{Name = "Stove 1", Category= "Stoves", ID = 1, Price = 99.99},
new Product{Name = "Stove 2", Category= "Fireplaces", ID = 2, Price = 139.50},
new Product{Name = "Stove 3", Category= "Stoves", ID = 3, Price = 199.99},
new Product{Name = "Stove 4", Category= "Stoves", ID = 4, Price = 29.00},
};
}
}
}
Run Code Online (Sandbox Code Playgroud)
这是我在View:@model List中打印这些数据的方法
@{
ViewBag.Title = "AllProducts";
}
<h2>AllProducts</h2>
<ul> …Run Code Online (Sandbox Code Playgroud)