小编Tro*_*son的帖子

属性表达式无效.表达式应代表属性

我有这两个实体

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在 …

entity-framework-6

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

Firebase 云功能非常慢

我使用 Firebase 的免费套餐,并且有一个由实时数据库写入触发的云功能。然后,该函数从 Firebase 存储 (~8 Mb) 下载文件,进行一些处理,然后写回实时数据库。我在整个函数中添加了一些日志语句,以找出为什么花了这么长时间。

  • 该功能立即触发(良好)。
  • 下载该文件大约需要 3 分钟(不好)。
  • 处理过程大约需要 20 分钟才能完成(呃,什么?)

当我在本地运行该函数时,它会在 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

5
推荐指数
0
解决办法
1543
查看次数

Angular UI-Router嵌套状态模板未呈现

我是ui-router的新手,无法获取layout.directory.teamslayout.directory.people加载各自的模板.我希望这些模板可以加载ui-viewlayout状态模板上.

/dashboard工作正常... dashboard.html模板加载ui-viewcontent.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)

angularjs angular-ui-router

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

如何使用Criteria打印List <T>?

这是我的简单列表:

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)

c# asp.net-mvc razor

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